0

I wanted to try codes from http://csie.nqu.edu.tw/smallko/sdn/dijkstra_ryu.htm but when I try to run the codes, it doesn't work. There always 'ImportError: No module dijkstra_ryu.py' error

I am using Ubuntu 16.04.4 LTS, python 2.7.12 and 3.5.2, and ryu 4.23.

Here's what happen:

ray@raihanr:~/ryu/ryu/app$ ryu-manager dijkstra_ryu.py --observe-links
loading app dijkstra_ryu.py
Traceback (most recent call last):
File "/usr/local/bin/ryu-manager", line 9, in 
load_entry_point('ryu==4.23', 'console_scripts', 'ryu-manager')()
File "/usr/local/lib/python2.7/dist-packages/ryu/cmd/manager.py", line 98, in main
app_mgr.load_apps(app_lists)
File "/usr/local/lib/python2.7/dist-packages/ryu/base/app_manager.py", line 415, in load_apps
cls = self.load_app(app_cls_name)
File "/usr/local/lib/python2.7/dist-packages/ryu/base/app_manager.py", line 392, in load_app
mod = utils.import_module(name)
File "/usr/local/lib/python2.7/dist-packages/ryu/utils.py", line 104, in import_module
return importlib.import_module(modname)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
ImportError: No module named dijkstra_ryu.py

I also tried using:

ryu/ryu/app$ ryu-manager --observe-links dijkstra_ryu.py

but it keeps showing the same error

Sadly, I also try this:

:~$ryu-manager ryu/ryu/app/dijkstra_ryu.py --observe-links

then a new error shows up

ImportError: Import by filename is not supported.

I already checked every module and not missing any part.

Raihan Radito
  • 11
  • 1
  • 5
  • I'm assuming the `dijkstra_ryu.py` file is in the `/ryu/ryu/app` directory? – Alan Kavanagh Mar 27 '19 at 10:29
  • Not clear from the documentation, but some links ive seen online say python 3 is required to run it. Also check that you have the necessary permissions for the `/ryu/ryu/app` directory – Nick Mar 27 '19 at 10:35
  • @AK47 yes, it is but I don't understand why it the error say so – Raihan Radito Mar 27 '19 at 10:48
  • @Nick I forgot to mention that I already installed python 3.5.2 and I also checked that the dijktra_ryu file has the same permission like the other files in the folder. The strange part is the other files is working as it should be but dijkstra_ryu is not – Raihan Radito Mar 27 '19 at 10:59
  • @RaihanRadito Visit this link -> http://csie.nqu.edu.tw/smallko/sdn/dijkstra_ryu.htm and copy the code to a new file also called `dijkstra_ryu.py`, and overwrite your current one with it. Then ensure the permissions are correct and try again – Nick Mar 27 '19 at 11:24
  • @Nick done but it still showing the same error – Raihan Radito Mar 31 '19 at 07:23

1 Answers1

1

I FOUND IT GUYS. the problem is in the spacing rules. the codes are messy, so we need to make it right for spacing that is 4 times when the codes are inside the definition, for, if, and etc.

Raihan Radito
  • 11
  • 1
  • 5