Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: expected only letters, got u'' #1072

Closed
brianmay opened this issue Jul 4, 2017 · 4 comments
Closed

ValueError: expected only letters, got u'' #1072

brianmay opened this issue Jul 4, 2017 · 4 comments

Comments

@brianmay
Copy link

brianmay commented Jul 4, 2017

I have been told this is due to the latest python-babel package.

This was reported against Debian, and reproduced against version 1.8.0.

for loc in django_extensions/locale/*; do \
	python setup.py compile_catalog --directory django_extensions/locale/ --locale $(basename $loc) --domain django; \
done
running compile_catalog
compiling catalog django_extensions/locale/cs/LC_MESSAGES/django.po to django_extensions/locale/cs/LC_MESSAGES/django.mo
running compile_catalog
catalog django_extensions/locale/da/LC_MESSAGES/django.po is marked as fuzzy, skipping
running compile_catalog
compiling catalog django_extensions/locale/de/LC_MESSAGES/django.po to django_extensions/locale/de/LC_MESSAGES/django.mo
running compile_catalog
compiling catalog django_extensions/locale/el/LC_MESSAGES/django.po to django_extensions/locale/el/LC_MESSAGES/django.mo
running compile_catalog
catalog django_extensions/locale/en/LC_MESSAGES/django.po is marked as fuzzy, skipping
running compile_catalog
compiling catalog django_extensions/locale/es/LC_MESSAGES/django.po to django_extensions/locale/es/LC_MESSAGES/django.mo
running compile_catalog
compiling catalog django_extensions/locale/et/LC_MESSAGES/django.po to django_extensions/locale/et/LC_MESSAGES/django.mo
running compile_catalog
compiling catalog django_extensions/locale/fr/LC_MESSAGES/django.po to django_extensions/locale/fr/LC_MESSAGES/django.mo
running compile_catalog
compiling catalog django_extensions/locale/hu/LC_MESSAGES/django.po to django_extensions/locale/hu/LC_MESSAGES/django.mo
running compile_catalog
compiling catalog django_extensions/locale/it/LC_MESSAGES/django.po to django_extensions/locale/it/LC_MESSAGES/django.mo
running compile_catalog
compiling catalog django_extensions/locale/ja/LC_MESSAGES/django.po to django_extensions/locale/ja/LC_MESSAGES/django.mo
running compile_catalog
catalog django_extensions/locale/pl/LC_MESSAGES/django.po is marked as fuzzy, skipping
running compile_catalog
compiling catalog django_extensions/locale/pt/LC_MESSAGES/django.po to django_extensions/locale/pt/LC_MESSAGES/django.mo
running compile_catalog
Traceback (most recent call last):
  File "setup.py", line 156, in <module>
    'Topic :: Utilities',
  File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/dist-packages/babel/messages/frontend.py", line 182, in run
    self._run_domain(domain)
  File "/usr/lib/python2.7/dist-packages/babel/messages/frontend.py", line 221, in _run_domain
    catalog = read_po(infile, locale)
  File "/usr/lib/python2.7/dist-packages/babel/messages/pofile.py", line 331, in read_po
    parser.parse(fileobj)
  File "/usr/lib/python2.7/dist-packages/babel/messages/pofile.py", line 265, in parse
    self._process_comment(line)
  File "/usr/lib/python2.7/dist-packages/babel/messages/pofile.py", line 224, in _process_comment
    self._finish_current_message()
  File "/usr/lib/python2.7/dist-packages/babel/messages/pofile.py", line 164, in _finish_current_message
    self._add_message()
  File "/usr/lib/python2.7/dist-packages/babel/messages/pofile.py", line 158, in _add_message
    self.catalog[msgid] = message
  File "/usr/lib/python2.7/dist-packages/babel/messages/catalog.py", line 603, in __setitem__
    self.mime_headers = _parse_header(message.string).items()
  File "/usr/lib/python2.7/dist-packages/babel/messages/catalog.py", line 406, in _set_mime_headers
    self.locale = Locale.parse(value)
  File "/usr/lib/python2.7/dist-packages/babel/core.py", line 267, in parse
    parts = parse_locale(identifier, sep=sep)
  File "/usr/lib/python2.7/dist-packages/babel/core.py", line 1093, in parse_locale
    raise ValueError('expected only letters, got %r' % lang)
ValueError: expected only letters, got u''
@trbs
Copy link
Member

trbs commented Jul 5, 2017

Thanks for reporting this !

I have added compile-catalog as a target in tox and travis so we get alerted on this in the future.

Cannot quickly see why it only PT fails. I might just remove the translation to get the build working again.

p.s. I would love to get the debian build files into the repository if we can.

@trbs trbs closed this as completed Jul 5, 2017
@trbs
Copy link
Member

trbs commented Jul 5, 2017

Should be fixed in 1.8.1

@trbs
Copy link
Member

trbs commented Jul 5, 2017

found some other issues, so not yet able to close this

@trbs trbs reopened this Jul 5, 2017
@trbs
Copy link
Member

trbs commented Jul 5, 2017

Should be fixed in the upcoming 1.8.1 release.

If Debian wants to patch the older version, this patch should help:


diff --git a/django_extensions/locale/pt_BR/LC_MESSAGES/django.po b/django_extensions/locale/pt_BR/LC_MESSAGES/django.po
index c5e12b0..5928e28 100644
--- a/django_extensions/locale/pt_BR/LC_MESSAGES/django.po
+++ b/django_extensions/locale/pt_BR/LC_MESSAGES/django.po
@@ -12,7 +12,7 @@ msgstr ""
 "PO-Revision-Date: 2013-09-13 22:49-0300\n"
 "Last-Translator: Claudemiro Alves Feitosa <dimiro1@gmail.com>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
-"Language: \n"
+"Language: pt_BR\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"

@trbs trbs closed this as completed Aug 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants