How to use miniedit in mininet?. Can anyone suggest the commands - python

I am not able to run the command $ sudo ~/mininet/examples/miniedit.py in mininet.When I type that command to use miniedit the output comes as Traceback (most recent call last):
File "./mininet/examples/miniedit.py", line 63, in
from mininet.log import info, debug, warn, setLogLevel
ImportError: No module named mininet.log

you have to execute miniedit.py from remote terminal "that has visualization" using ssh .

I had the same problem, all I did was change the default file path to desktop /usr/lib/python2.7/dist-packages/mininet/examples path to Desktop and it works

Related

Python code works on interpreter but not when I use pyinstaller

I am creating a bot and I am using libs like pandas, numpy and sklearn and I have also installed all these libraries in a virtual env. The bot works fine on Pycharm but when I use pyinstaller and create a standalone, it's standalone shows this error:
Traceback (most recent call last):
File "PyInstaller\loader\pyiboot01_bootstrap.py", line 167, in __init__
File "ctypes\__init__.py", line 373, in __init__
FileNotFoundError: Could not find module 'C:\Users\vabha\AppData\Local\Temp\_MEI38962\sklearn\.libs\vcomp140.dll' (or one of its dependencies). Try using the full path with constructor syntax.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "chandlerbing.py", line 3, in <module>
from sklearn.pipeline import Pipeline
.
.
.
Console debbug say FileNotFoundError... Let me translate it for you.
vcomp140.dll is missing and need to be used you had it on temporary location and now is not any more. Try also look on this answer or you can try also Auto Py To Exe maybe will work.
You need to have all the libraries installed in the same environment as pyinstaller. You probably installed pyinstaller in a global environment so you should install the libraries in the globa environment.

tkinter.TclError: no display name and no $DISPLAY environment variable python

I want to execute my python file in a remote system using ssh. I exported the file to the remote system.
Here's the sample file:
import os
import time
import pymsgbox
pymsgbox.alert('Hi Afreeth ', 'Welcome')
if 'DISPLAY' not in os.environ:
pass
I want to execute it using ssh from my system and it should display in the remote system.
But it fails
Error i got:
Traceback (most recent call last):
File "cd1.py", line 5, in <module>
File "pymsgbox/__init__.py", line 100, in alert
File "pymsgbox/__init__.py", line 156, in _buttonbox
File "tkinter/__init__.py", line 1871, in __init__
_tkinter.TclError: no display name and no $DISPLAY environment variable
[12113] Failed to execute script myprogram
How to fix it. I found some answers on stack but it doesn't solve me. If i go and execute it in the remote system, it works. But when i execute from my system,it fails. How to fix it.
Found the Answer:
I just need to run export DISPLAY=:0 in their ssh session and programs run will run on the remote display. A quick example:
paulsteven#smackcoders:~$ ssh afreeth#his_ipaddress
afreeth#smackcoders:~$ export DISPLAY=:0
afreeth#smackcoders:~$ firefox
Firefox is now running on afreeth's display.

Debugging in PyCharm with using Vagrant VM connection - cannot import name to_string

I've encountered an issue where I cannot debug in PyCharm connecting through Vagrant to the VM. This has worked fine for projects up until now. The VM image was recently updated so I'm wondering if that has had an effect. I can run programs in "run" mode, just not debug mode. Here's the error I get
Traceback (most recent call last):
File "/home/vagrant/.pycharm_helpers/pydev/pydevd.py", line 25, in <module>
from _pydevd_bundle import pydevd_vars
File "/home/vagrant/.pycharm_helpers/pydev/_pydevd_bundle/pydevd_vars.py", line 21, in <module>
from _pydevd_bundle.pydevd_utils import to_string
ImportError: cannot import name to_string
Here are the different commands used to run the programs - the first one is debug mode, the second is normal mode
ssh://vagrant#127.0.0.1:2222/usr/bin/python -u /home/vagrant/.pycharm_helpers/pydev/pydevd.py --multiproc --qt-support --client '0.0.0.0' --port 32807 --file /home/vagrant/.pycharm_helpers/pycharm/utrunner.py /vagrant/project/project_test.py::ProjectTest true
ssh://vagrant#127.0.0.1:2222/usr/bin/python -u /home/vagrant/.pycharm_helpers/pycharm/utrunner.py /vagrant/project/project_test.py::ProjectTest true
Any ideas what why to_string is found in normal mode but not debug?
The solution was to delete the /home/vagrant/.pycharm_helpers directory and restart PyCharm and vagrant to regenerate the directory.

Import error with remote interpreter in pycharm

I am trying to run my code in the server using ssh remote interpreter.
The connection and the deployment work but when I want to import libraries located in the server it gives an import error
ssh://***#****.com:22/usr/bin/python -u
/home//main.py Traceback
(most recent call last): File
"/home//main.py", line 11,
in
from clplibs.clp import ContinuousLearningPlatform as clp ImportError: No module named clplibs.clp
Process finished with exit code 1
I've found a solution, the environment variables (including python path) should be defined from pycharm: Run/Debug configurations-> Environment variables. Pycharm won't use bashrc paths.

qsub python import

I'm running a job on the cluster for the first time. I run it with the following command:
qsub -cwd -S /usr/bin/python myScript.py
I have a python script that starts with:
import time
import anotherScript
The error I get:
Traceback (most recent call last):
File "/opt/sge62/default/spool/hpc01/job_scripts/487174", line 11, in <module>
import anotherScript
ImportError: No module named anotherScript
the anotherScript.py is in the same directory as myScript.py.
What can I do to solve the problem? would appreciate any help
well, problem was solved by sys.path.append(currentWorkingDirectory). However, it's definitely not a nice way.

Categories