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

Fix python3 support for builder.py #903

Merged
merged 1 commit into from
Dec 8, 2017
Merged

Fix python3 support for builder.py #903

merged 1 commit into from
Dec 8, 2017

Conversation

kentsommer
Copy link
Contributor

@kentsommer kentsommer commented Dec 8, 2017

subprocess.Popen().communicate() returns a byte string in Python 3 (equal to a standard string in Python 2). Attempting to decode the string works on both Python 2 and Python 3 and fixes the following error:

==> Generating an env.sh
Unhandled exception of type 'TypeError':
Traceback (most recent call last):
  File "./src/catkin/bin/../python/catkin/builder.py", line 981, in build_workspace_isolated
    number=index + 1, of=len(ordered_packages)
  File "./src/catkin/bin/../python/catkin/builder.py", line 691, in build_package
    destdir=destdir, use_ninja=use_ninja
  File "./src/catkin/bin/../python/catkin/builder.py", line 606, in build_cmake_package
    arch = get_multiarch()
  File "./src/catkin/bin/../python/catkin/builder.py", line 284, in get_multiarch
    assert(not out.strip() or out.strip().count('-') == 2)
TypeError: a bytes-like object is required, not 'str'
<== Failed to process package 'octomap': 
  a bytes-like object is required, not 'str'
Command failed, exiting.

I also removed the err return since it wasn't being used for anything.

subprocess.Popen().communicate() returns a byte string in Python 3 (equal to a standard string in Python 2). Attempting to decode the string works on both Python 2 and Python 3 and fixes the following error:

```
==> Generating an env.sh
Unhandled exception of type 'TypeError':
Traceback (most recent call last):
  File "./src/catkin/bin/../python/catkin/builder.py", line 981, in build_workspace_isolated
    number=index + 1, of=len(ordered_packages)
  File "./src/catkin/bin/../python/catkin/builder.py", line 691, in build_package
    destdir=destdir, use_ninja=use_ninja
  File "./src/catkin/bin/../python/catkin/builder.py", line 606, in build_cmake_package
    arch = get_multiarch()
  File "./src/catkin/bin/../python/catkin/builder.py", line 284, in get_multiarch
    assert(not out.strip() or out.strip().count('-') == 2)
TypeError: a bytes-like object is required, not 'str'
<== Failed to process package 'octomap': 
  a bytes-like object is required, not 'str'
Command failed, exiting.
```
@dirk-thomas
Copy link
Member

Thank you for the patch.

@dirk-thomas dirk-thomas merged commit 80005c1 into ros:kinetic-devel Dec 8, 2017
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