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

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 679: ordinal not in range(128) #34

Open
juanesarango opened this issue Nov 22, 2024 · 1 comment

Comments

@juanesarango
Copy link
Contributor

  • toil_container version: 1.1.7
  • Python version: 2.7.15
  • Operating System: "Red Hat Enterprise Linux 8.6 (Ootpa)"

Getting this error:

Traceback (most recent call last):
  File ".../venv__toil_brass__v1.0.2/bin/toil_brass", line 8, in <module>
    sys.exit(main())
  File ".../venv__toil_brass__v1.0.2/lib/python2.7/site-packages/toil_brass/cli.py", line 23, in main
    commands.main()
  File ".../venv__toil_brass__v1.0.2/lib/python2.7/site-packages/toil_brass/commands.py", line 453, in main
    options = get_parser().parse_args()
  File ".../venv__toil_brass__v1.0.2/lib/python2.7/site-packages/toil_container/parsers.py", line 226, in parse_args
    validators.validate_singularity(**validate_kwargs)
  File ".../venv__toil_brass__v1.0.2/lib/python2.7/site-packages/toil_container/validators.py", line 16, in validate_singularity
    _validate_image(singularity_call, image, volumes, working_dir)
  File ".../venv__toil_brass__v1.0.2/lib/python2.7/site-packages/toil_container/validators.py", line 31, in _validate_image
    call(image, cmd, check_output=True, **kwargs)
  File ".../venv__toil_brass__v1.0.2/lib/python2.7/site-packages/toil_container/containers.py", line 134, in singularity_call
    return output.decode()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 679: ordinal not in range(128)

As singularity call is not returning a binary encoded output. This might be related with default encoding of the host.

Fixed by specifying explicitly the encoding:

return output.decode("utf-8")
@ddomenico
Copy link
Contributor

Testing a new branch with utf-8 explicitly defined in decode(): https://github.com/papaemmelab/toil_container/tree/v1.1.8

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

No branches or pull requests

2 participants