gettext on Windows

russ.phillips.nospam at russ.phillips.nospam at
Sat Oct 28 11:33:46 CEST 2006

Martin v. Löwis wrote:
> russ.phillips.nospam at schrieb:
> > Traceback (most recent call last):
> >   File "", line 36, in ?
> >     lan = gettext.GNUTranslations (open (sLang, "rb"))
> >   File "C:\Python24\lib\", line 177, in __init__
> >     self._parse(fp)
> >   File "C:\Python24\lib\", line 280, in _parse
> >     raise IOError(0, 'File is corrupt', filename)
> > IOError: [Errno 0] File is corrupt: 'locale\\'
> If it says so, it likely is right. How did you create the file?

I only get the "File is corrupt" error when I changed

lan = gettext.GNUTranslations (open (sLang))


lan = gettext.GNUTranslations (open (sLang, "rb"))

Without the "rb" in the open () I get a "struct.error : unpack str size
does not match format" error (see original post).

The .mo files were created using poEdit (, and I get the
same error with various translations, all created by different people.


More information about the Python-list mailing list