While trying to enable the openflow.webservice.py and web.webcore.py modules from pox on RedHat 6.4 Linux… I kept receiving the following error…
[root@sdn-A4 Python-2.7.3]# python -u /opt/pox/pox.py --verbose forwarding.l2_pairs web.webcore openflow.webservice POX 0.2.0 (carp) / Copyright 2011-2013 James McCauley, et al. Traceback (most recent call last): File "/opt/pox/pox/boot.py", line 91, in do_import2 __import__(name, level=0) File "/opt/pox/pox/openflow/webservice.py", line 50, in <module> from pox.openflow.of_json import * File "/opt/pox/pox/openflow/of_json.py", line 111 _unfix_map = {k:_unfix_null for k in of.ofp_match_data.keys()} ^ SyntaxError: invalid syntax Could not import module: openflow.webservice
It was working fine on my MacOSx with Mavericks, but was getting the above error on Red Hat. After looking at the version of pox on both systems… I saw no difference. The only difference was Red Hat was running Python 2.6.6 and MacOSx was running 2.7.3.
The fix? Upgrade Python, BUT do not replace version 2.6.6 in the system path because YUM depends on it.
Run the following commands…
mkdir /opt/Python-273 cd /opt/Python-273 wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz tar -xvzf Python-2.7.3.tgz yum install gcc cd Python-2.7.3 ./configure make altinstall alias python273="/opt/Python-273/Python-2.7.3/python"
Now that python 2.7.3 is installed… just make sure you run POX with the new version alias command.
python273 pox.py