On Fri, 2 Aug 2013 10:21:20 -0400
Glenn McGuire <[email protected]> wrote:
> I've been using the latest RYU source from GIT, and building my own python
> eggs. When launching ryu-manager, I get the following error:
>
> [root@hostname ryu]# ryu-manager
> Traceback (most recent call last):
> File "/usr/bin/ryu-manager", line 5, in <module>
> pkg_resources.run_script('ryu==2.2', 'ryu-manager')
> File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 461, in
> run_script
> self.require(requires)[0].run_script(script_name, ns)
> File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1194, in
> run_script
> execfile(script_filename, namespace, namespace)
> File
> "/usr/lib/python2.6/site-packages/ryu-2.2-py2.6.egg/EGG-INFO/scripts/ryu-manager",
> line 43, in <module>
> from ryu.topology import switches
> File "build/bdist.linux-x86_64/egg/ryu/topology/switches.py", line 427,
> in <module>
> File "build/bdist.linux-x86_64/egg/ryu/topology/switches.py", line 574,
> in Switches
> AttributeError: 'module' object has no attribute 'EventOFPPortStatus'
>
> [root@hostname ryu]# python ./bin/ryu-manager
> Traceback (most recent call last):
> File "./bin/ryu-manager", line 55, in <module>
> from ryu.topology import switches
> File "build/bdist.linux-x86_64/egg/ryu/topology/switches.py", line 427,
> in <module>
> File "build/bdist.linux-x86_64/egg/ryu/topology/switches.py", line 574,
> in Switches
> AttributeError: 'module' object has no attribute 'EventOFPPortStatus'
>
> I found that I could execute ryu-manager correctly from the interactive
> python shell but not from the command line, and looked at the derivation of
> Event classes from pathnames.
> It occurred to me that the eggs would not necessarily include the source
> files, so I tried successfully to make the code look up both source and
> compiled filenames, and return the union of that.
>
> I have not tried to push it up via git, but I thought people might find
> this useful.
> This is what I came up with:
Thanks! I'll apply the following:
=
>From 59ff924f1f4eb8b2887aa97fd608890b938fb81a Mon Sep 17 00:00:00 2001
From: Glenn McGuire <[email protected]>
Date: Wed, 7 Aug 2013 13:05:29 +0900
Subject: [PATCH] ofproto: make binary code loadable
I've been using the latest RYU source from GIT, and building my own python
eggs. When launching ryu-manager, I get the following error:
[root@hostname ryu]# ryu-manager
Traceback (most recent call last):
File "/usr/bin/ryu-manager", line 5, in <module>
pkg_resources.run_script('ryu==2.2', 'ryu-manager')
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 461, in
run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 1194, in
run_script
execfile(script_filename, namespace, namespace)
File
"/usr/lib/python2.6/site-packages/ryu-2.2-py2.6.egg/EGG-INFO/scripts/ryu-manage\
r",
line 43, in <module>
from ryu.topology import switches
File "build/bdist.linux-x86_64/egg/ryu/topology/switches.py", line 427,
in <module>
File "build/bdist.linux-x86_64/egg/ryu/topology/switches.py", line 574,
in Switches
AttributeError: 'module' object has no attribute 'EventOFPPortStatus'
[root@hostname ryu]# python ./bin/ryu-manager
Traceback (most recent call last):
File "./bin/ryu-manager", line 55, in <module>
from ryu.topology import switches
File "build/bdist.linux-x86_64/egg/ryu/topology/switches.py", line 427,
in <module>
File "build/bdist.linux-x86_64/egg/ryu/topology/switches.py", line 574,
in Switches
AttributeError: 'module' object has no attribute 'EventOFPPortStatus'
I found that I could execute ryu-manager correctly from the interactive
python shell but not from the command line, and looked at the derivation of
Event classes from pathnames.
It occurred to me that the eggs would not necessarily include the source
files, so I tried successfully to make the code look up both source and
compiled filenames, and return the union of that.
Signed-off-by: FUJITA Tomonori <[email protected]>
---
ryu/ofproto/__init__.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/ryu/ofproto/__init__.py b/ryu/ofproto/__init__.py
index 90ead38..ea3c5fa 100644
--- a/ryu/ofproto/__init__.py
+++ b/ryu/ofproto/__init__.py
@@ -22,25 +22,28 @@ from ryu import utils
_OFPROTO_DIR = os.path.dirname(__file__)
+
_OFPROTO_PARSER_FILE_NAMES = glob.glob(os.path.join(
- _OFPROTO_DIR, 'ofproto_v[0-9]*_[0-9]*_parser.py'))
+ _OFPROTO_DIR, 'ofproto_v[0-9]*_[0-9]*_parser.py*'))
_OFPROTO_PARSER_FILE_NAMES = [os.path.basename(name)
for name in _OFPROTO_PARSER_FILE_NAMES]
_OFPROTO_MODULES = {}
for parser_file_name in _OFPROTO_PARSER_FILE_NAMES:
- # drop lasting '.py'
- parser_mod_name = __name__ + '.' + parser_file_name[:-3]
- consts_mod_name = parser_mod_name[:-7] # drop lasting '_parser'
+ # drop tailing '.py*'
+ parser_mod_name = __name__ + '.' + \
+ '.'.join(parser_file_name.split('.')[:-1])
+ consts_mod_name = parser_mod_name[:-7] # drop trailing '_parser'
try:
parser_mod = utils.import_module(parser_mod_name)
consts_mod = utils.import_module(consts_mod_name)
except:
continue
- assert consts_mod.OFP_VERSION not in _OFPROTO_MODULES
- _OFPROTO_MODULES[consts_mod.OFP_VERSION] = (consts_mod, parser_mod)
+ #assert consts_mod.OFP_VERSION not in _OFPROTO_MODULES
+ if consts_mod.OFP_VERSION not in _OFPROTO_MODULES:
+ _OFPROTO_MODULES[consts_mod.OFP_VERSION] = (consts_mod, parser_mod)
def get_ofp_modules():
--
1.7.12.4 (Apple Git-37)
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel