lemieuxl / pyGenClean

Automated genetic data clean up procedure in Python.
GNU General Public License v3.0
3 stars 1 forks source link

UnicodeDecodeError when unicode in paths #10

Closed lemieuxl closed 8 years ago

lemieuxl commented 8 years ago

When creating the automatic report, the script fails with a UnicodeDecodeError when there is a unicode in the path of the working directory.

Traceback (most recent call last):
  File ".../pyGenClean_virt/bin/run_pyGenClean", line 9, in <module>
    load_entry_point('pyGenClean==1.7.1', 'console_scripts', 'run_pyGenClean')()
  File ".../pyGenClean/run_data_clean_up.py", line 3130, in safe_main
    main()
  File ".../pyGenClean_virt/pyGenClean/run_data_clean_up.py", line 186, in main
    options,
  File ".../pyGenClean_virt/pyGenClean/run_data_clean_up.py", line 1785, in run_find_related_samples
    path=latex_template.sanitize_fig_name(path),
  File ".../pyGenClean_virt/lib/python2.7/site-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File ".../pyGenClean_virt/lib/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File ".../pyGenClean_virt/pyGenClean/LaTeX/templates/graphics_template.tex", line 4, in top-level template code
    \includegraphics[width=\VAR{ width }]{\VAR{ path }}
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 19: ordinal not in range(128)
lemieuxl commented 8 years ago

In order to correct this bug, we will need to use the codecs module, and to decode every abspath to unicode.

lemieuxl commented 8 years ago

Oups...