Latest version of python for mac 10.7.56/26/2023 ![]() So using the wxFileDialog in a bundled app somehow alters the way character encoding is handled, at least when using wxProcess to interact with the operating system. You will only see this when you've built an app bundle and have opened a wxFileDialog. You can run the test repeatedly without opening the File Dialog and you won't see this. You can run from source code and you won't see this. Even though I explicitly encode the unicode sample text to a utf-8 string as part of the wxProcess call. I want to re-iterate, we have a STRING object here, not a unicode object, with an unencoded unicode character in it. We get character 246, which is the correct character for the unencoded unicode character, what we get with unichr(246), instead of the utf8-encoded character combination chr(195) + chr(182) for that character. But this time, it returns a string of length 8, and the unicode character in our unicode text sample is NOT encoded using utf8. It, of course, does exactly the same thing it did before. We've done nothing but open a wxFileDialog and closed it again. Now press the Open a File Dialog button and press Cancel on the File Dialog. This is exactly what I expect.Ĭlose the Test Window. You see that echo is called, and what is returned is a string of length 9 with the utf-8-encoded string representation of the unicode test sample. (The problem doesn't occur on Windows.) Press the Open Test Window button. ![]() "python setup_TEST.py py2app", of course.īuild and run test.app on OS X. Setup_TEST.py is a py2app setup script for packaging test.py. The unicode text sample is encoded to utf-8 during the wxProcess call. This call simply passes the unicode text sample to the OS's "echo" command and reads the result. MediaConvertTest.py shows a TextCtrl with unicode text sample in it and automatically calls a very simple OS call using wxProcess. This wxFileDialog doesn't DO anything, but it doesn't need to. One calls up a test window (described next) and the other simply opens a wxFileDialog. Test.py, the main program, shows two buttons. I have created a radically simplified sample app to demonstrate the underlying problem. I found this to be true when I had used py2app to package my application into a distributable bundle, but not when I am running from source code. I recently noticed that once I have opened a wxFileDialog, my FFMpeg call stops working with Unicode file names, that is, those with accented characters. ![]() In my application, I use wxProcess to call FFMpeg to do media conversion. However, I have reason to believe the same issues occurs with Python 2.6.6, wxPython 2.8.12.0, and bundlebuilder.
0 Comments
Leave a Reply. |