Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django makemessages errors Unknown encoding "utf8"

Tags:

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?

like image 316
Rodrigo Ferrari Avatar asked Dec 06 '10 19:12

Rodrigo Ferrari


1 Answers

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

like image 180
Quentin Avatar answered Oct 12 '22 22:10

Quentin