noxrepo / pox

The POX network software platform
https://noxrepo.github.io/pox-doc/html/
Apache License 2.0
619 stars 470 forks source link

SyntaxError: Running the command python ./pox.py forwarding.l3_detection #260

Closed saminresearch closed 3 years ago

saminresearch commented 3 years ago

4

Facing issue while running this command. Can you please tell what am I doing wrong?

MurphyMc commented 3 years ago

l3_detection is not a component that ships with POX; I don't know where it came from or who wrote it.

But the problem is certainly that it was written for Python 2. It's using the old Python 2 print statement.

POX, starting with the "gar" version (which you're using) uses Python 3.

You have two options: Fix the component to work with Python 3, or downgrade to POX fangtooth (which uses Python 2).

Fixing the component may just mean you rewrite the print to use the print function instead of the print statement. If you also do from __future__ import print_function at the top of the file, it may run in both gar and older versions of POX as well.

Incidentally, I'm not sure why a POX component would ever use print at all. Logging is set up by default and the POX getLogger() is even easier to use than the normal Python one in most cases. Almost every official POX component uses it.