gettext on Windows

russ.phillips.nospam at russ.phillips.nospam at
Sat Oct 28 10:23:04 CEST 2006

Fredrik Lundh wrote:
> russ.phillips.nospam at wrote:
> > lan = gettext.GNUTranslations (open (sLang))
> are you sure the data file is a text file?  what happens if you change
> the above to
>    lan = gettext.GNUTranslations (open (sLang, "rb"))

The .mo files aren't text files, they're binary, but when I make that
change, I get this error message:

Traceback (most recent call last):
  File "", line 36, in ?
    lan = gettext.GNUTranslations (open (sLang, "rb"))
  File "C:\Python24\lib\", line 177, in __init__
  File "C:\Python24\lib\", line 280, in _parse
    raise IOError(0, 'File is corrupt', filename)
IOError: [Errno 0] File is corrupt: 'locale\\'


More information about the Python-list mailing list