Non ASCII character generating errors
Closed this issue · 1 comments
N1c093 commented
Hello,
first of all thank you for this program.
Currently there seems to be a problem when I'm using non ASCII character in the pdf-file name. For example "ß", "ä", "ö", "ü"
There is also an error message in the log. The file name was "Saturn Bestellbestätigung.pdf":
--- Logging error ---
Traceback (most recent call last):
File "/volume2/@appstore/py3k/usr/local/lib/python3.5/logging/__init__.py",
line 982, in emit
stream.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 75: ordinal not in range(128) Call stack:
File "/volume2/scripts/env/bin/attachment-downloader", line 83, in <module>
logging.info("Downloading attachment '%s' to path %s", attachment.get('filename'), download_path)
Message: "Downloading attachment '%s' to path %s"
Arguments: ('Saturn Bestellbest\xe4tigung.pdf', '/volume2/homes/user/_OCR/Saturn Bestellbest\xe4tigung.pdf')
2020-10-16 09:30:03,345 - ERROR - 'ascii' codec can't encode character '\xe4' in position 77: ordinal not in range(128) Traceback (most recent call last):
File "/volume2/scripts/env/bin/attachment-downloader", line 85, in <module>
if os.path.isfile(download_path):
File "/volume2/@appstore/py3k/usr/local/lib/python3.5/genericpath.py",
line 30, in isfile
st = os.stat(path)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 77: ordinal not in range(128)
2020-10-16 09:30:03,346 - ERROR - Error saving file. Continuing...
2020-10-16 09:30:03,346 - INFO - Finished processing messages
It would be great if you could provide a fix for it.
Thank you in advance.
N1c093 commented
I just noticed, that this problem only exists, when you run it with the (Synology) task scheduler. So the program doesn't have an bug.
I found the solution for my problem on this webpage: https://stackoverflow.com/questions/38174485/python3-unicodeencodeerror-when-run-via-synology-task-scheduler