I’ve just used bench migrate-env python3 to upgrade my python version but now I cannot download PDF files. It shows an internal server error with the following error in the logs
[2019-04-07 01:03:42 +0300] [19874] [ERROR] Error handling request /api/method/frappe.utils.print_format.download_pdf?doctype=Sales%20Invoice&name=%CE%99%CE%9F-%CE%A4%CE%A0%CE%A5-00048&format=Invoice%20-%20Greek%20ORIGINAL&no_letterhead=1&_lang=en
Traceback (most recent call last):
File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/gunicorn/workers/sync.py", line 135, in handle
self.handle_request(listener, req, client, addr)
File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/gunicorn/workers/sync.py", line 182, in handle_request
resp.write(item)
File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/gunicorn/http/wsgi.py", line 333, in write
self.send_headers()
File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/gunicorn/http/wsgi.py", line 329, in send_headers
util.write(self.sock, util.to_bytestring(header_str, "ascii"))
File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/gunicorn/util.py", line 507, in to_bytestring
return value.encode(encoding)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 160-163: ordinal not in range(128)
Can you say what version bench and ERPNext, and also the output of: locale from a terminal? Is there a non standard character in the form ? Perhaps post a screenshot of the form before trying to convert to PDF.
Just a couple things that might help us help…Preformatted text
If gunicorn is suspect, I wonder if installing python3-gunicorn would help. Otherwise , a google search of relevant parts of the UnicodeEncodeError message + ERPNext turns up a few posts that might help. .
Thanks for trying to help. Unfortunately installing python3-gunicorn made no difference as the code is still there converting utf8 characters to ascii.
I think this will need a lot more info from the devs to troubleshoot.