gettext on Windows

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


Martin v. Löwis wrote:
> russ.phillips.nospam at googlemail.com schrieb:
> > Traceback (most recent call last):
> >   File "panicbutton.py", line 36, in ?
> >     lan = gettext.GNUTranslations (open (sLang, "rb"))
> >   File "C:\Python24\lib\gettext.py", line 177, in __init__
> >     self._parse(fp)
> >   File "C:\Python24\lib\gettext.py", line 280, in _parse
> >     raise IOError(0, 'File is corrupt', filename)
> > IOError: [Errno 0] File is corrupt: 'locale\\fr_FR.mo'
>
> 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))

to

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 (www.poedit.org), and I get the
same error with various translations, all created by different people.

Russ




More information about the Python-list mailing list