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

python 3 compatibility #279

Merged
merged 3 commits into from
Nov 1, 2013
Merged

python 3 compatibility #279

merged 3 commits into from
Nov 1, 2013

Conversation

dirk-thomas
Copy link
Member

@tfoote @wjwwood Please review.

@wjwwood
Copy link
Contributor

wjwwood commented Oct 23, 2013

Does this overlap at all with #43?

@dirk-thomas
Copy link
Member Author

I was not aware of the other pull request. The other one seems to contain more things (some of which I am not sure why they are necessaru) but outdated. This pull request contains the changes I had to make to get the rosdep command init and update working with Python 3.3 on Saucy.

from urllib2 import urlopen
from urllib2 import URLError
try:
import pickle as pickle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be cPickle. It provided a noteable speedup. I'm not sure if that still holds for python3.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the pull request to try import cPickle as pickle which was the initial idea of it.

@tfoote
Copy link
Member

tfoote commented Oct 23, 2013

One comment otherwise +1

@wjwwood
Copy link
Contributor

wjwwood commented Oct 23, 2013

In Python3 c... prefixed things are gone, the fastest implementation is always made available. But I think your comment holds that cPickle should probably be used for Py2.x cases.

@tfoote
Copy link
Member

tfoote commented Oct 30, 2013

Python 3 unit tests failing. Looks like rosdistro needs to be ported first.

Writing /tmp/easy_install-cnt65i/rosdistro-0.2.15/setup.cfg
Running rosdistro-0.2.15/setup.py -q bdist_egg --dist-dir /tmp/easy_install-cnt65i/rosdistro-0.2.15/egg-dist-tmp-3rikdi
  File "build/bdist.linux-x86_64/egg/rosdistro/rosdistro.py", line 372
    except Exception, ex:
                    ^
SyntaxError: invalid syntax
zip_safe flag not set; analyzing archive contents...
  File "/home/travis/virtualenv/python3.2/lib/python3.2/site-packages/rosdistro-0.2.15-py3.2.egg/rosdistro/rosdistro.py", line 372
    except Exception, ex:
                    ^
SyntaxError: invalid syntax

@dirk-thomas
Copy link
Member Author

It's finally green. Please (re)review.

@tfoote
Copy link
Member

tfoote commented Oct 31, 2013

+1

@@ -62,7 +62,7 @@ class RosdepInternalError(Exception):
def __init__(self, e, message=None):
self.error = e
if message is None:
self.message = traceback.format_exc(e)
self.message = traceback.format_exc()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work the same on Py26?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should work. The optional argument should be the limit - never the exception itself. I guess 2.x was just nicer in handling this wrong argument.

@wjwwood
Copy link
Contributor

wjwwood commented Oct 31, 2013

+1

dirk-thomas added a commit that referenced this pull request Nov 1, 2013
@dirk-thomas dirk-thomas merged commit 62c93e9 into ros-infrastructure:master Nov 1, 2013
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

Successfully merging this pull request may close these issues.

3 participants