Hello,
I continue to work on improving the i18n for my video analysis software. I recently discovered what I'm pretty sure is a wxPython or wxWidgets bug.
On Windows, the wx.MediaCtrl cannot load files that have non-cp1252 PATHS if the QuickTime back end is used.
To be more specific, the file "E:\Vidëo\亲亳 亲\Test-MOV.mov" will not load in the wx.MediaCtrl() because of the Chinese characters in the PATH portion of the file name. However, the file "E:\Vidëo\Unicödê\亲亳亲-AnalysisMOV.mov" loads fine because the PATH is cp1252 even though there's Chinese in the file name itself. The MPEG-1 versions of both files load fine on Windows because we're not using the QuickTime back end, and both QuickTime files load fine on OS X, just not Windows. (I don't have the capacity to test this on Linux.)
So my question is, should I report this as a bug? If so, to wxPython or to wxWidgets?
Here's my work-around code, if anyone's interested: (self.movie is a wx.MediaCtrl, and filename is the file name with full path.)
# First, detect Windows and QuickTime
if ('wxMSW' in wx.PlatformInfo) and (self.backend == wx.media.MEDIABACKEND_QUICKTIME):
# Change the Python Encoding to cp1252
wx.SetDefaultPyEncoding('cp1252')
# Get the Current Working Directory
originalCWD = os.getcwd()
# Divide the path and the file name from each other
(currentPath, currentFileName) = os.path.split(filename)
# Change the Current Directory to the file's location
os.chdir(currentPath)
# Encode just the File Name portion of the path
tmpfilename = currentFileName.encode(sys.getfilesystemencoding())
# If we're not on Windows OR we aren't using QuickTime ...
else:
# ... then the unencoded file name including the full path works just fine!
tmpfilename = filename
# Try to load the file in the media player.
if self.movie.Load(tmpfilename):
<snip>
# Again, detect Windows and QuickTime
if ('wxMSW' in wx.PlatformInfo) and (self.backend == wx.media.MEDIABACKEND_QUICKTIME):
# Reset the Default Python encoding back to UTF8
wx.SetDefaultPyEncoding('utf8')
# Reset the Current Working Directory to what it used to be
os.chdir(originalCWD)
Thanks,
David
David K. Woods, Ph.D.
Researcher, Transana Lead Developer
Wisconsin Center for Education Research
University of Wisconsin, Madison
http://www.transana.org