[Pythonmac-SIG] py2app, wxPython, and unicode

Charles Hartman charles.hartman at conncoll.edu
Tue Apr 26 04:46:55 CEST 2005


Maybe this is the wrong place to ask. (I'm confused.) I've got a Mac 
2.4.1 app using the unicode build of wxPython 2.5.4.1. I'm loading a 
text file that contains an accented (>128) character and displaying it 
in a wxPython widget (a StyledTextCtrl). I've got the encoding/decoding 
etc all taken care of (I think!) elsewhere inside the app. But now I 
have a problem right at the front end, reading and displaying the file.

It works fine in the WingIDE.

When I build it with py2app, though, I get a problem. If I use this:
             self.myStyledTextCtrl.DisplayText(f.read())
the file is displayed up to the line that includes the accented 
character, then no more. If I use this:
             defaultEncoding = wx.GetDefaultPyEncoding()
              . . .
             data = f.read()
             self.WholeText.DisplayText(unicode(data, defaultEncoding))
the file doesn't display at all.

Because of the difference between standalone and in-the-IDE, I can't 
figure out where the problem lies. Any clues very welcome. (I'm getting 
very sick of unicode.)

Charles Hartman



More information about the Pythonmac-SIG mailing list