wxpython

joe jacob joejacob21 at gmail.com
Wed Jan 23 06:31:20 EST 2008


I am trying to open a file containing non displayable characters like
contents an exe file. The is is with the below mentioned code:

self.text_ctrl_1.SetValue(file_content)

If the file_content contains non displayable characters I am getting
an error like this:

Traceback (most recent call last):
  File "C:\Documents and Settings\joe_jacob\Desktop\notepad.py", line
102, in open_file
    self.text_ctrl_1.SetValue(file_content)
  File "D:\softwares\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx
\_controls.py", line 1708, in SetValue
    return _controls_.TextCtrl_SetValue(*args, **kwargs)
  File "D:\softwares\Python25\lib\encodings\cp1252.py", line 15, in
decode
    return codecs.charmap_decode(input,errors,decoding_table)
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position
2: character maps to <undefined>

I am trying to create an encryption program so if I open any file even
if it is an exe file it should display in text ctrl.

What is this problem with this ? How can I rectify this?



More information about the Python-list mailing list