gettext on Windows

russ.phillips.nospam at googlemail.com russ.phillips.nospam at googlemail.com
Sat Oct 28 04:23:04 EDT 2006


Fredrik Lundh wrote:
> russ.phillips.nospam at googlemail.com 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 "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'

Russ




More information about the Python-list mailing list