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

rosnode: Minor fixes for compatibility with both Python 2 & 3 #1166

Merged
merged 1 commit into from
Sep 15, 2017
Merged

rosnode: Minor fixes for compatibility with both Python 2 & 3 #1166

merged 1 commit into from
Sep 15, 2017

Conversation

kartikmohta
Copy link
Contributor

No description provided.

@dirk-thomas
Copy link
Member

Please provide a reproducible example.

@@ -182,7 +182,6 @@ def get_nodes_by_machine(machine):
@raise ROSNodeException: if machine name cannot be resolved to an address
@raise ROSNodeIOException: if unable to communicate with master
"""
import urlparse
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Already imported at the top of the file so no need to import here. Moreover there is no urlparse module in Python 3.

@@ -338,7 +337,7 @@ def rosnode_ping(node_name, max_count=None, verbose=False):
# 3786: catch ValueError on unpack as socket.error is not always a tuple
try:
# #3659
errnum, msg = e
errnum, msg = e.args
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This way allows it to work for both Python 2 & 3. socket.error is just an alias of OSError in Python 3.

@dirk-thomas
Copy link
Member

Thank you for the patch.

Please include a description in future contributions.

@dirk-thomas dirk-thomas merged commit 1e67842 into ros:lunar-devel Sep 15, 2017
@kartikmohta kartikmohta deleted the fix/rosnode-py3 branch September 15, 2017 17:32
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.

2 participants