CAMI-challenge / AMBER

AMBER: Assessment of Metagenome BinnERs
https://cami-challenge.github.io/AMBER/
GNU General Public License v3.0
28 stars 7 forks source link

Error creating html - character encoding #42

Closed dpellow closed 4 years ago

dpellow commented 4 years ago

Hi Amber runs until the HTML phase and creates the expected outputs. In the html phase I get the following output:

2020-11-04 19:31:20,810 INFO Creating HTML page
Traceback (most recent call last):
  File "cami-env/bin/amber.py", line 302, in <module>
    main()
  File "cami-env/bin/amber.py", line 297, in main
    args.desc)
  File "/<path>/cami-env/lib/python3.7/site-packages/src/amber_html.py", line 872, in create_html
    f.write(html)
UnicodeEncodeError: 'latin-1' codec can't encode character '\ufffd' in position 775969: ordinal not in range(256)

I am running in a Python3.7 virtual environment and installed Amber using pip3 per the instructions on github.

Do you know what causes this error?

fernandomeyer commented 4 years ago

I haven't seen this one before. Could you provide the command you're using and the input files, so I can try to reproduce it?

I just now updated AMBER on PyPI, and you can upgrade it by using pip3 install --upgrade cami-amber. However, I'm not sure if this will eliminate the error.

Thanks

dpellow commented 4 years ago

Thanks for the quick response. The update didn't eliminate the error. I'm attaching a minimal example that causes the error, I see the same error with real data as well.

genomes.txt bins.txt

I run the following command: python cami-env/bin/amber.py -g ~/Downloads/test/genomes.txt -o ~/Downloads/test ~/Downloads/test/bins.txt

dpellow commented 4 years ago

I figured out that this had to do with the default encoding of the terminal on my system. You can see this by typing in locale charmap in the terminal - in my case it was ISO-8859-1 (latin-1). Updated this using export LANG="en_US.utf8" and now it works.

fernandomeyer commented 4 years ago

Great, thanks for the info!