Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
757 views
in Technique[技术] by (71.8m points)

python - Django makemessages errors Unknown encoding "utf8"

I installed python separated from yum.

Now, I need to recompile the language pack for the OSQA system, but get this message:

Error: errors happened while running xgettext on __init__.py
xgettext: ./Django-1.2.3/tests/regressiontests/views/__init__.py:1: Unknown encoding "utf8". Proceeding with ASCII instead.
xgettext: Non-ASCII string at ./Django-1.2.3/tests/regressiontests/views/__init__.py:7.
          Please specify the source encoding through --from-code or through a comment
          as specified in http://www.python.org/peps/pep-0263.html.

I tried to set encode at utf-8 in the manage.py file but it didn't work.

Can someone help me to solve this issue?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I know this post is outdated but I had the same issue today, and it took me hours to find out why. Maybe people will be in the same case :

My virtualenv is in my django root directory :

Here is my project tree :

DjangoDirectory:

  • my_env
  • Django_App1
  • Django_App2
  • ...
  • ...
  • manage.py

When I launch command :

./manage.py makemessages -l fr 

I get the same error :

Error: errors happened while running xgettext on __init__.py
...

In fact, I noticed that xgettext looked into ALL the files in my folder, as well as files in my_env.

So I found the -i flag which ignore files or folders during the makemessages process

So now, with the command below it works like a charm and I don't get the error anymore.

./manage.py makemessages -l fr -i my_env

Hope it will help


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...