Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P4run is not using 2.7 by default #10

Closed
BassamJaber opened this issue Mar 19, 2019 · 2 comments
Closed

P4run is not using 2.7 by default #10

BassamJaber opened this issue Mar 19, 2019 · 2 comments

Comments

@BassamJaber
Copy link

After installing p4-utils, I tried to run the example using p4run. However, it seems that it is using python3 instead of python2 and the default is python 2.7.

Traceback (most recent call last):
  File "/usr/local/bin/p4run", line 11, in <module>
    load_entry_point('p4utils', 'console_scripts', 'p4run')()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 487, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2728, in load_entry_point
    return ep.load()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2346, in load
    return self.resolve()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2352, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "~/utils/p4utils/p4run.py", line 155
    print ' '.join(items)
            ^
SyntaxError: invalid syntax
python --version 
Python 2.7.12

How can I force p4run to use python2.7 instead of python3.5 ?

@edgar-costa
Copy link
Collaborator

weird, because the p4run script is explicitly using python2

https://github.com/nsg-ethz/p4-utils/blob/master/p4utils/p4run.py#L1

How do you call p4run? Whats your pip version?

@BassamJaber
Copy link
Author

You are correct, pip is using python 3 instead. I managed to fix it by forcing python 2 for pip using
python -m pip instead of just pip in install.sh script
Thanks

edgar-costa added a commit that referenced this issue Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants