Opened 10 years ago

Closed 10 years ago

#6861 closed (fixed)

I18N fails on start. struct.error: unpack str size does not match format

Reported by: david.rubert@… Owned by: nobody
Component: Internationalization Version: master
Severity: Keywords: i18n gettext error
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Revision 7352 of repository applied some changes that prevent a i18n enabled project to start.

When I try to start a i18n enabled project, I get this:

Traceback (most recent call last):
  File "", line 16, in ?
  File "../shared/django/core/management/", line 272, in execute_manager
  File "../shared/django/core/management/", line 219, in execute
  File "../shared/django/core/management/", line 72, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "../shared/django/core/management/", line 81, in execute
  File "../shared/django/utils/translation/", line 73, in activate
    return real_activate(language)
  File "../shared/django/utils/translation/", line 43, in delayed_loader
    return g['real_%s' % caller](*args, **kwargs)
  File "../shared/django/utils/translation/", line 211, in activate
    _active[currentThread()] = translation(language)
  File "../shared/django/utils/translation/", line 200, in translation
    default_translation = _fetch(settings.LANGUAGE_CODE)
  File "../shared/django/utils/translation/", line 190, in _fetch
    res = _merge(apppath)
  File "../shared/django/utils/translation/", line 165, in _merge
    t = _translation(path)
  File "../shared/django/utils/translation/", line 156, in _translation
    t = gettext_module.translation('django', path, [loc], klass)
  File "/usr/lib/python2.4/", line 465, in translation
    t = _translations.setdefault(key, class_(open(mofile, 'rb')))
  File "../shared/django/utils/translation/", line 73, in __init__
    gettext_module.GNUTranslations.__init__(self, *args, **kw)
  File "/usr/lib/python2.4/", line 177, in __init__
  File "/usr/lib/python2.4/", line 260, in _parse
    magic = unpack('<I', buf[:4])[0]
struct.error: unpack str size does not match format

Change History (3)

comment:1 Changed 10 years ago by James Bennett

[7352] could not have done this; please try an earlier revision to locate the error.

comment:2 Changed 10 years ago by Malcolm Tredinnick

This error message suggests that your .mo file is somehow corrupt. Try regenerating it from the PO file again.

The line of code that is raising the error isn't Django dependent at all. It's trying to parse the entire MO file to prepare that translation for use and it cannot parse that file.

comment:3 Changed 10 years ago by david.rubert@…

Resolution: fixed
Status: newclosed

You're totally right. It was a weird corrupted .mo file. Once regenerated, everything works again.

Note: See TracTickets for help on using tickets.
Back to Top