frappe / frappe_docker

Docker images for production and development setups of the Frappe framework and ERPNext
MIT License
1.41k stars 1.32k forks source link

UnicodeDecodeError during the setup wizard process #4

Closed sunhoww closed 7 years ago

sunhoww commented 7 years ago

I got this error while going through the set wizard for a new site.

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 57, in application
    response = frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 22, in handle
    data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 53, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 922, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py", line 108, in get_charts_for_country
    if (fname.startswith(country_code) or fname.startswith(country)) and fname.endswith(".json"):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 19: ordinal not in range(128)

This error occurs specifically when trying to parse the filename string fr_plan_comptable_général.json. Probably because of the é characters. (So, the setup wizard progresses fine when I move or rename this file.)

Initially while doing executing bench start I got this [WARNING]-

Your terminal is not configured to receive UTF-8 encoded text. Please adjust your locale settings or force UTF-8 output by setting PYTHONIOENCODING="utf-8".

So, I set this environment variable, which doesn't solve this issue.

I then found the locale is not set. Which is where I got stuck. I haven't figured which locale variable to set. Maybe I am approaching this all wrong. Any suggestion regarding this would be tremendously helpful.

BTW, the host machine is running Arch Linux - kernel: 4.12.8-2-ARCH

sunhoww commented 7 years ago

Setting LC_ALL to C.UTF-8 solves this issue. I've been using

LC_ALL="C.UTF-8" bench start

to run the dev server. It works fine but maybe we could export this env var in Dockerfile.