[Answer]-UnicodeDecodeError with compilemessages django translator

1👍

Look at your traceback, obviously, your .po file is not at fault:

File "/usr/lib/python2.7/site-packages/django/core/management/commands/compilemessages.py", line 42, in compile_messages
    if not f.endswith('.po'):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 5: ordinal not in range(128)

See that if not?

There’s (at least) one file, most likely a Python file, in your repo that has a non-ASCII character in it. All you have to do is find it and add this at the top:

#coding:utf-8

Or whatever encoding is used for that file. Since you’re on Linux, it’s most likely indeed going to be utf-8, but that could depend on your editor.


If you have trouble finding said file, just open /usr/lib/python2.7/site-packages/django/core/management/commands/compilemessages.py, and before that line 42 if clause, add a print f line.

Then run the command. You should see the culprit just above the traceback.

Once you’ve found it, just remove that print statement.

Leave a comment