5

Am building a site with Django. After downloading gettext-0.19.8.tar.gz ---> /Users/cohen/Downloads/gettext-0.19.8 and running all of the steps ./configure make and sudo make installation I received this error during it's installation below:

python manage.py makemessages -l en

Everything ran smoothly with the Gettext part until the instalation. I am using a MAC, using Pycharm as my IDE. Please advise!

PS there is a way to bipass the gettext instalation in order to make the messages?

Thank you!

xgettext: ./venv/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/webencodings/__init__.py:1: Unknown encoding "utf8". Proceeding with ASCII instead.
xgettext: Non-ASCII string at ./venv/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/webencodings/__init__.py:64.
          Please specify the source encoding through --from-code or through a comment
          as specified in http://www.python.org/peps/pep-0263.html.

Why i got this error. I can't do the proper translation with this command

I followed this training: Django internationalization minimal example

http://www.marinamele.com/taskbuster-django-tutorial/internationalization-localization-languages-time-zones

https://gist.github.com/mbillard/1647940

LATER EDIT: After reinstalling gettext in the virtualenv i got this error:

make[4]: Nothing to be done for `install-exec-am'.
 ../build-aux/install-sh -c -d '/Users/cohen/PycharmProjects/gettext/share/doc/gettext/examples/build-aux'
 /usr/bin/install -c -m 644 ../build-aux/javacomp.sh.in ../build-aux/javaexec.sh.in ../build-aux/csharpcomp.sh.in ../build-aux/csharpexec.sh.in '/Users/cohen/PycharmProjects/gettext/share/doc/gettext/examples/build-aux'
 ../build-aux/install-sh -c -d '/Users/cohen/PycharmProjects/gettext/share/gettext'
 /usr/bin/install -c ../build-aux/config.rpath '/Users/cohen/PycharmProjects/gettext/share/gettext'
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.

And the make check results: Testsuite summary for gettext-tools 0.19.8

> ============================================================================
> # TOTAL: 198
> # PASS:  187
> # SKIP:  10
> # XFAIL: 0
> # FAIL:  1
> # XPASS: 0
> # ERROR: 0
> ============================================================================ See gnulib-tests/test-suite.log Please report to
> bug-gnu-gettext@gnu.org
> ============================================================================ make[7]: *** [test-suite.log] Error 1 make[6]: *** [check-TESTS] Error
> 2 make[5]: *** [check-am] Error 2 make[4]: *** [check-recursive] Error
> 1 make[3]: *** [check] Error 2 make[2]: *** [check-recursive] Error 1
> make[1]: *** [check-recursive] Error 1 make: *** [check] Error 2
Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129
Cohen
  • 944
  • 3
  • 13
  • 40

4 Answers4

2

In order to fix this bug, you have to edit the files that have the error. In my case I entered into the files from my venv /venv/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/webencodings/__init__.py and edit 3 files

1.init.py
2. tests.py
3.x_user_defined.py

in their head I changed the string

utf8

into

utf-8.

This helped me to create the messages in Pycharm.

Have a great day!

Cohen
  • 944
  • 3
  • 13
  • 40
0

Instead of building it for yourself, I would rather install it via Homebrew - it makes things easier to maintain in the long run:

brew install gettext

If it complains something like

Warning: gettext is keg-only and must be linked with --force

you need to run

brew link gettext --force

and then it should work fine. (If it still doesn't, rebuild the virtualenv.)

Scorchio
  • 2,763
  • 2
  • 20
  • 28
0

Just open file ./venv/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/webencodings/__init__.py and change "utf8" to "utf-8" on the 1st line.

0

You should run the command with --ignore venv or -i venv ignoring virtual environment (venv in your case) as shown below, then the error is solved. *You can see my answer explaining why the error occurs in detail:

python manage.py makemessages --ignore en venv
python manage.py makemessages -i en venv

The commands below also work:

django-admin makemessages --ignore en venv
django-admin makemessages -i en venv
Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129