Steve Carson wrote:
I am trying to write the output of a unix man command to a wxTextCtrl
called textRev.output = commands.getoutput('man ls')
self.textRev.WriteText(output)This throws this error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position
1519: ordinal not in range(128)I am not sure what encoding the man command outputs in or what encoding
the wxTextCtrl is expecting so I dont know how to proceed.
Somebody suggested using self.textRev.WriteText(unicode(output,"ISO 8859-1") ) this stops the error but does not display the man command output
correctly.
The man command usually outputs a lot of ESC sequences to set the terminal to bold or underline or whatever. IIRC there is an option to get it to display the raw text with no formatting, that is probably what you'll need to use. Otherwise you'll want to interpret the formatting yourself and set the styles in the textctrl accordingly.
ยทยทยท
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!