amitnilams / sdwan-gym

AI gym for SD-WAN
9 stars 4 forks source link

TypeError: Can't convert 'bytes' object to str implicitly #3

Open turtle-23 opened 5 years ago

turtle-23 commented 5 years ago

While running deterministic_trial.py file ,getting this error.

/home/ubuntu/.local/lib/python3.5/site-packages/cfg_load/init.py:83: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. config = yaml.load(stream) 2019-06-03 06:20:48,646 - root - INFO - SdwanEnv - Version 0.1.0 Traceback (most recent call last): File "deterministic_trial.py", line 7, in env = gym.make('Sdwan-v0') File "/home/ubuntu/.local/lib/python3.5/site-packages/gym/envs/registration.py", line 156, in make return registry.make(id, kwargs) File "/home/ubuntu/.local/lib/python3.5/site-packages/gym/envs/registration.py", line 101, in make env = spec.make(kwargs) File "/home/ubuntu/.local/lib/python3.5/site-packages/gym/envs/registration.py", line 73, in make env = cls(**_kwargs) File "/home/ubuntu/sdwan-gym/gym_sdwan/envs/sdwan_env.py", line 50, in init self.backend = MininetBackEnd(mu=4, sigma=2, link_bw=self.LINK_BW, sla_bw=6, seed=100) File "/home/ubuntu/sdwan-gym/gym_sdwan/envs/mininet_backend.py", line 38, in init self.net = Mininet( topo=None, listenPort=6633, ipBase='10.0.0.0/8') File "/usr/local/lib/python3.5/dist-packages/mininet-2.2.1-py3.5.egg/mininet/net.py", line 154, in init File "/usr/local/lib/python3.5/dist-packages/mininet-2.2.1-py3.5.egg/mininet/util.py", line 488, in numCores File "/usr/local/lib/python3.5/dist-packages/mininet-2.2.1-py3.5.egg/mininet/util.py", line 132, in quietRun File "/usr/local/lib/python3.5/dist-packages/mininet-2.2.1-py3.5.egg/mininet/util.py", line 103, in errRun TypeError: Can't convert 'bytes' object to str implicitly

amitnilams commented 5 years ago

This is python 3 issue. Please compile with Python 2.7 On Monday, June 3, 2019, 12:03:14 PM GMT+5:30, turtle-23 notifications@github.com wrote:

/home/ubuntu/.local/lib/python3.5/site-packages/cfg_load/init.py:83: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. config = yaml.load(stream) 2019-06-03 06:20:48,646 - root - INFO - SdwanEnv - Version 0.1.0 Traceback (most recent call last): File "deterministic_trial.py", line 7, in env = gym.make('Sdwan-v0') File "/home/ubuntu/.local/lib/python3.5/site-packages/gym/envs/registration.py", line 156, in make return registry.make(id, **kwargs) File "/home/ubuntu/.local/lib/python3.5/site-packages/gym/envs/registration.py", line 101, in make env = spec.make(kwargs) File "/home/ubuntu/.local/lib/python3.5/site-packages/gym/envs/registration.py", line 73, in make env = cls(_kwargs) File "/home/ubuntu/sdwan-gym/gym_sdwan/envs/sdwan_env.py", line 50, in init self.backend = MininetBackEnd(mu=4, sigma=2, link_bw=self.LINK_BW, sla_bw=6, seed=100) File "/home/ubuntu/sdwan-gym/gym_sdwan/envs/mininet_backend.py", line 38, in init self.net = Mininet( topo=None, listenPort=6633, ipBase='10.0.0.0/8') File "/usr/local/lib/python3.5/dist-packages/mininet-2.2.1-py3.5.egg/mininet/net.py", line 154, in init File "/usr/local/lib/python3.5/dist-packages/mininet-2.2.1-py3.5.egg/mininet/util.py", line 488, in numCores File "/usr/local/lib/python3.5/dist-packages/mininet-2.2.1-py3.5.egg/mininet/util.py", line 132, in quietRun File "/usr/local/lib/python3.5/dist-packages/mininet-2.2.1-py3.5.egg/mininet/util.py", line 103, in errRun TypeError: Can't convert 'bytes' object to str implicitly

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

turtle-23 commented 5 years ago

In my ubuntu system ,root has python 3 and I cant degrade the python version .So ,I am executing this file inside a virtual environment with python 2.7. But while running python file I got the error:

Traceback (most recent call last): File "deterministic_trial.py", line 7, in env = gym.make("Sdwan-v0") File "/home/ubuntu/my_env/local/lib/python2.7/site-packages/gym/envs/registration.py", line 156, in make return registry.make(id, kwargs) File "/home/ubuntu/my_env/local/lib/python2.7/site-packages/gym/envs/registration.py", line 101, in make env = spec.make(kwargs) File "/home/ubuntu/my_env/local/lib/python2.7/site-packages/gym/envs/registration.py", line 72, in make cls = load(self._entry_point) File "/home/ubuntu/my_env/local/lib/python2.7/site-packages/gym/envs/registration.py", line 17, in load mod = importlib.import_module(mod_name) File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module import(name) File "/home/ubuntu/sdwan-gym/gym_sdwan/envs/init.py", line 3, in from gym_sdwan.envs.mininet_backend import MininetBackEnd File "/home/ubuntu/sdwan-gym/gym_sdwan/envs/mininet_backend.py", line 3, in from mininet.net import Mininet

Then I copied "mininet" folder inside /home/ubuntu/sdwan-gym/gym_sdwan/envs folder. But now this message is coming on screen:

/home/ubuntu/my_env/local/lib/python2.7/site-packages/cfg_load/init.py:83: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. config = yaml.load(stream) 2019-06-04 08:32:17,274 - root - INFO - SdwanEnv - Version 0.1.0 *** Mininet must run as root.

I can't use sudo python deterministic_trial.py command to run the file as it will use python 3. Please guide me on the steps to project setup .

Thanks in advance :)

amitnilams commented 5 years ago

source your virtual env inside your .bashrc and then do a "sudo bash". Then run the python file.(Do not directly run with python file with sudo as you have figured it out already). Also clear the mininet by mn -c command after every trial as it will say 'configuration already exists'. On Tuesday, June 4, 2019, 2:14:48 PM GMT+5:30, turtle-23 notifications@github.com wrote:

In my ubuntu system ,root has python 3 and I cant degrade the python version .So ,I am executing this file inside a virtual environment with python 2.7. But while running python file I got the error:

Traceback (most recent call last): File "deterministic_trial.py", line 7, in env = gym.make("Sdwan-v0") File "/home/ubuntu/my_env/local/lib/python2.7/site-packages/gym/envs/registration.py", line 156, in make return registry.make(id, kwargs) File "/home/ubuntu/my_env/local/lib/python2.7/site-packages/gym/envs/registration.py", line 101, in make env = spec.make(kwargs) File "/home/ubuntu/my_env/local/lib/python2.7/site-packages/gym/envs/registration.py", line 72, in make cls = load(self._entry_point) File "/home/ubuntu/my_env/local/lib/python2.7/site-packages/gym/envs/registration.py", line 17, in load mod = importlib.import_module(mod_name) File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module import(name) File "/home/ubuntu/sdwan-gym/gym_sdwan/envs/init.py", line 3, in from gym_sdwan.envs.mininet_backend import MininetBackEnd File "/home/ubuntu/sdwan-gym/gym_sdwan/envs/mininet_backend.py", line 3, in from mininet.net import Mininet

Then I copied "mininet" folder inside /home/ubuntu/sdwan-gym/gym_sdwan/envs folder. But now this message is coming on screen:

/home/ubuntu/my_env/local/lib/python2.7/site-packages/cfg_load/init.py:83: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. config = yaml.load(stream) 2019-06-04 08:32:17,274 - root - INFO - SdwanEnv - Version 0.1.0 *** Mininet must run as root.

I can't use sudo python deterministic_trial.py command to run the file as it will use python 3. Please guide me on the steps to project setup .

Thanks in advance :)

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub, or mute the thread.