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

UnicodeEncodeError with non-ASCII character in environment #338

Closed
roehling opened this issue Apr 19, 2016 · 6 comments
Closed

UnicodeEncodeError with non-ASCII character in environment #338

roehling opened this issue Apr 19, 2016 · 6 comments

Comments

@roehling
Copy link
Contributor

On my system, I have the environment variable DEBFULLNAME=Timo Röhling (note the non-ASCII umlaut in my last name) set, which causes catkin build to raise the following exception:

[build] Found '275' packages in 0.0 seconds.                                   
[build] Package table is up to date.                                           
[build] An internal error occurred!                                            
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/catkin_tools/verbs/catkin_build/build.py", line 549, in build_isolated_workspace
    continue_without_deps=False))
  File "/usr/lib/python2.7/dist-packages/catkin_tools/execution/executor.py", line 375, in run_until_complete
    return loop.run_until_complete(coroutine)
  File "/usr/lib/python2.7/dist-packages/trollius/base_events.py", line 273, in run_until_complete
    return future.result()
  File "/usr/lib/python2.7/dist-packages/trollius/futures.py", line 277, in result
    raise self._exception
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 484: ordinal not in range(128)

Once I unset DEBFULLNAME, everything works.

You can reproduce the bug by running eval $(printf 'export NON_ASCII=\xc3\xb6') at the bash prompt before invoking catkin build.

@jbohren jbohren added the bug label Apr 19, 2016
@jbohren
Copy link
Contributor

jbohren commented Apr 19, 2016

Thanks, @roehling. This is definitely with 0.4.0, but can you tell me not about your OS and Python version?

@roehling
Copy link
Contributor Author

It's Ubuntu 14.04 LTS ("Trusty") with Python 2.7

@jbohren
Copy link
Contributor

jbohren commented Apr 19, 2016

@roehling thanks!

@roehling
Copy link
Contributor Author

I came up with a more useful stack trace by running catkin build --get-env:

Traceback (most recent call last):
  File "/usr/bin/catkin", line 9, in <module>
    load_entry_point('catkin-tools==0.4.0', 'console_scripts', 'catkin')()
  File "/usr/lib/python2.7/dist-packages/catkin_tools/commands/catkin.py", line 258, in main
    catkin_main(sysargs)
  File "/usr/lib/python2.7/dist-packages/catkin_tools/commands/catkin.py", line 253, in catkin_main
    sys.exit(args.main(args) or 0)
  File "/usr/lib/python2.7/dist-packages/catkin_tools/verbs/catkin_build/cli.py", line 358, in main
    return print_build_env(ctx, opts.get_env[0])
  File "/usr/lib/python2.7/dist-packages/catkin_tools/verbs/catkin_build/cli.py", line 231, in print_build_env
    environ = get_env_loader(pkg, context)(os.environ)
  File "/usr/lib/python2.7/dist-packages/catkin_tools/jobs/utils.py", line 73, in load_env
    strict=False)
  File "/usr/lib/python2.7/dist-packages/catkin_tools/resultspace.py", line 156, in get_resultspace_environment
    for k, v in parse_env_str(lines.decode('utf-8')).items()
  File "/usr/lib/python2.7/dist-packages/catkin_tools/common.py", line 652, in parse_env_str
    print('WARNING: Could not parse env string: `{}`'.format(environ_str),
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 688: ordinal not in range(128)

@jbohren
Copy link
Contributor

jbohren commented Apr 19, 2016

@roehling Thanks for the additional stack trace, #342 should fix your problem. I hope catkin_tools didn't offend you!

@jbohren jbohren modified the milestone: 0.4.x - Beta 2 Patches Apr 19, 2016
scpeters added a commit to scpeters/catkin_tools that referenced this issue Apr 19, 2016
Regression test for issue catkin#338.
scpeters added a commit to scpeters/catkin_tools that referenced this issue Apr 19, 2016
Regression test for issue catkin#338.
wjwwood pushed a commit that referenced this issue Apr 19, 2016
Regression test for issue #338.
@roehling
Copy link
Contributor Author

@jbohren thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants