UnicodeDecodeError con compilemessages django traductor
Frecuentes
Visto 1,150 equipos
0
Me sale este error
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 5: ordinal not in range(128)
while I want to comiple .po
El uso de archivos
python django.admin.py manage.py compilemessages
This is my django.po file:
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-05-28 11:39+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: blog/forms.py:6
msgid "name"
msgstr ""
#: blog/forms.py:7
msgid "e-mail"
msgstr ""
#: blog/forms.py:8
msgid "comment"
msgstr ""
#: blog/Template/post.html:34
msgid "send"
msgstr ""
Rastrear:
python2.7 manage.py compilemessages
processing file django.po in /home/arash/Lab/django/arash_blog/conf/locale/fa_IR/LC_MESSAGES
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/usr/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/usr/lib/python2.7/site-packages/django/core/management/commands/compilemessages.py", line 71, in handle
compile_messages(self.stdout, locale=locale)
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)
1 Respuestas
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)
Mira eso 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
cláusula, agregue una print f
la línea.
Then run the command. You should see the culprit just above the traceback.
Once you've found it, just remove that print statement.
contestado el 28 de mayo de 14 a las 13:05
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas django or haz tu propia pregunta.
What version of python are you using? This can't be all of the meesage: what is the rest of the traceback? - GreenAsJade
i use python version 2.7 and dpaste.de/c2z9 - Arash Sadeghizadeh