ryu No module named

[root@kunpeng82 sdx-ryu]# ryu-manager ctrl/asdx.py 
loading app ctrl/asdx.py
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/ryu/utils.py", line 99, in import_module
    return _import_module_file(modname)
  File "/usr/local/lib/python3.6/site-packages/ryu/utils.py", line 88, in _import_module_file
    return load_source(modname, abspath)
  File "/usr/local/lib/python3.6/site-packages/ryu/utils.py", line 42, in load_source
    return loader.load_module(name)
  File "", line 399, in _check_name_wrapper
  File "", line 823, in load_module
  File "", line 682, in load_module
  File "", line 265, in _load_module_shim
  File "", line 684, in _load
  File "", line 665, in _load_unlocked
  File "", line 674, in exec_module
  File "", line 781, in get_code
  File "", line 741, in source_to_code
  File "", line 219, in _call_with_frames_removed
  File "/root/ryu/sdx-ryu/ctrl/asdx.py", line 270
    if (cookie <> 0):
                ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/ryu-manager", line 11, in 
    load_entry_point('ryu==4.34', 'console_scripts', 'ryu-manager')()
  File "/usr/local/lib/python3.6/site-packages/ryu/cmd/manager.py", line 98, in main
    app_mgr.load_apps(app_lists)
  File "/usr/local/lib/python3.6/site-packages/ryu/base/app_manager.py", line 415, in load_apps
    cls = self.load_app(app_cls_name)
  File "/usr/local/lib/python3.6/site-packages/ryu/base/app_manager.py", line 392, in load_app
    mod = utils.import_module(name)
  File "/usr/local/lib/python3.6/site-packages/ryu/utils.py", line 104, in import_module
    return importlib.import_module(modname)
  File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 994, in _gcd_import
  File "", line 971, in _find_and_load
  File "", line 941, in _find_and_load_unlocked
  File "", line 219, in _call_with_frames_removed
  File "", line 994, in _gcd_import
  File "", line 971, in _find_and_load
  File "", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'ctrl/asdx'
[root@kunpeng82 sdx-ryu]#

  

 

 

[root@kunpeng82 sdx-ryu]# export PYTHONPATH=/root/ryu/sdx-ryu/ctrl:$PYTHONPATH
[root@kunpeng82 sdx-ryu]# ls
ctrl  examples  README.md  ryu  setup  Vagrantfile  xrs
[root@kunpeng82 sdx-ryu]# ryu-manager ./ctrl/asdx.py 
loading app ./ctrl/asdx.py
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/ryu/utils.py", line 99, in import_module
    return _import_module_file(modname)
  File "/usr/local/lib/python3.6/site-packages/ryu/utils.py", line 88, in _import_module_file
    return load_source(modname, abspath)
  File "/usr/local/lib/python3.6/site-packages/ryu/utils.py", line 42, in load_source
    return loader.load_module(name)
  File "", line 399, in _check_name_wrapper
  File "", line 823, in load_module
  File "", line 682, in load_module
  File "", line 265, in _load_module_shim
  File "", line 684, in _load
  File "", line 665, in _load_unlocked
  File "", line 674, in exec_module
  File "", line 781, in get_code
  File "", line 741, in source_to_code
  File "", line 219, in _call_with_frames_removed
  File "/root/ryu/sdx-ryu/ctrl/asdx.py", line 270
    if (cookie <> 0):
                ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/ryu-manager", line 11, in 
    load_entry_point('ryu==4.34', 'console_scripts', 'ryu-manager')()
  File "/usr/local/lib/python3.6/site-packages/ryu/cmd/manager.py", line 98, in main
    app_mgr.load_apps(app_lists)
  File "/usr/local/lib/python3.6/site-packages/ryu/base/app_manager.py", line 415, in load_apps
    cls = self.load_app(app_cls_name)
  File "/usr/local/lib/python3.6/site-packages/ryu/base/app_manager.py", line 392, in load_app
    mod = utils.import_module(name)
  File "/usr/local/lib/python3.6/site-packages/ryu/utils.py", line 104, in import_module
    return importlib.import_module(modname)
  File "/usr/lib64/python3.6/importlib/__init__.py", line 121, in import_module
    raise TypeError(msg.format(name))
TypeError: the 'package' argument is required to perform a relative import for './ctrl/asdx.py'
[root@kunpeng82 sdx-ryu]# ls ctrl/asdx.py 
ctrl/asdx.py
[root@kunpeng82 sdx-ryu]# 
[root@kunpeng82 sdx-ryu]# export PYTHONPATH=/root/ryu/sdx-ryu/ctrl:$PYTHONPATH
[root@kunpeng82 sdx-ryu]# ryu-manager asdx.py

 

1134   export PYTHONPATH=/root/ryu/sdx-ryu/ctrl:$PYTHONPATH
 1135  ryu-manager /root/ryu/sdx-ryu/ctrl/asdx.py 

 

你可能感兴趣的:(ryu No module named)