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 in Travis for non-ascii chars in command line help. #5205

Closed
HenningTimm opened this issue Jul 13, 2017 · 2 comments
Closed

Comments

@HenningTimm
Copy link
Contributor

In one of the argparse help messages of ddrage I use a 'μ' ('\u03bc'). When the test rage --help is run and the parameters should be printed, the test fails:

[...]
[Jul 13 12:10:53] SERR File "/usr/local/lib/python3.5/argparse.py", line 2364, in _print_message
[Jul 13 12:10:53] SERR file.write(message)
[Jul 13 12:10:53] SERR UnicodeEncodeError: 'ascii' codec can't encode character '\u03bc' in position 5183: ordinal not in range(128)
[Jul 13 12:10:53] ERRO Task processing failed: Unexpected exit code [1] of container [b0fdac31d42b step-2e9c8ed4d2], container preserved
[...]

This is most certainly due to the fact that the busybox image has no UTF-8 support, as mentioned in issue #4961. Is there a workaround for this? As I see this I have the following options:

  • Remove the non-ascii chars from my messages (I would prefer not to).
  • Use a different test than rage --help (I would need to add an option specificlly for this).

Is there any other way? For my own code I can just change this, but how should we handle this in other software?

@yesimon
Copy link
Contributor

yesimon commented Aug 22, 2017

Depending on how much unicode you use you may just wrap the failing parts in a try-except and fallback print u instead of μ. It's not the most elegant fix but allows you to support environments purposely without unicode.

@mbargull
Copy link
Member

This can now be done with the "extended base" image:

extra:
  container:
    # extended-base generates en_US.UTF-8 locale and sets LC_ALL, LANG properly
    extended-base: True

. We should document this some time; tracking that via bioconda/bioconda-utils#225

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

No branches or pull requests

3 participants