I18n issue with optik

Thorsten Kampe thorsten at thorstenkampe.de
Sat Mar 31 18:01:33 EDT 2007


Hi,

I've written a script which uses Optik/Optparse to display the 
options (which works fine). The text for the help message is localised 
(with german umlauts) and when I execute the script with the localised 
environment variable set, I get this traceback[1]. The interesting 
thing is that the localised optparse messages from displays fine - 
it's only my localisation that errors.

>From my understanding, my script doesn't put out anything, it's 
optik/optparse who does that. My po file is directly copied from the 
optik po file (who displays fine) and modified so the po file should 
be fine, too.

What can I do to troubleshoot whether the culprit is my script, optik 
or gettext?

Would it make sense to post the script and the mo or po files?


Thorsten

[1]
Traceback (most recent call last):
  File "script.py", line 37, in <module>
    options, args = cmdlineparser.parse_args()
  File "/usr/lib/python2.5/optparse.py", line 1378, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib/python2.5/optparse.py", line 1418, in _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib/python2.5/optparse.py", line 1493, in 
_process_long_opt
    option.process(opt, value, values, self)
  File "/usr/lib/python2.5/optparse.py", line 782, in process
    self.action, self.dest, opt, value, values, parser)
  File "/usr/lib/python2.5/optparse.py", line 804, in take_action
    parser.print_help()
  File "/usr/lib/python2.5/optparse.py", line 1648, in print_help
    file.write(self.format_help().encode(encoding, "replace"))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 
264: ordinal not in range(128)



More information about the Python-list mailing list