UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 5: ordinal not in range(128)

Issue #19 wontfix
Former user created an issue

Using the pyrescene.py script, fails whne trying to add the attached file.

Traceback (most recent call last):
  File "/usr/local/bin/pyrescene.py", line 1039, in <module>
    sys.exit(main())
  File "/usr/local/bin/pyrescene.py", line 965, in main
    result = generate_srr(release_dir, working_dir, options)
  File "/usr/local/bin/pyrescene.py", line 691, in generate_srr
    rescene.add_stored_files(srr, copied_files, working_dir, True, False)
  File "/usr/local/lib/python2.7/dist-packages/rescene/main.py", line 277, in add_stored_files
    _store(f, tmpfile, save_paths, in_folder)
  File "/usr/local/lib/python2.7/dist-packages/rescene/main.py", line 1354, in _store
    _fire(MsgCode.STORING, message="Storing file: %s" % file_name)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 5: ordinal not in range(128)

Comments (3)

  1. vadmium

    For what it’s worth, these ASCII decoding issues do not happen in Python 3. My code in Pull Request #8 does not have this issue, nor Issue #22 (as long as you run it with Python 3).

    This particular issue is caused by os.walk() returning undecoded byte strings in pyrescene.get_files(). You might be able to fix it by decoding the strings using sys.getfilesystemencoding(), but I suspect similar issues would just crop up in other places. It might be easier to just use Python 3 instead :P

  2. Log in to comment