Python Ogre with WxPython causes program to hang


31-12-2009 19:08:38

Has anyone had issues with PythonOgre 1.6.4 and wxPyhon apps hanging after trying to close the program? I am also using Python 2.5.4
The ogre.log shows it stops at unloading materials. I can't tell if this is the problem or if something after this is causing it. Im not getting any useful feedback from the program.

I discovered the problem happens only after I use a wx.FileDialog class to browse for a file. If I do not do this then the application exits happily. For the life of me I can't figure out why this specific class would cause this to happen. I set it up so that I simply open the file dialog and then cancel it. I made sure that I called the Destroy method afterwards. Basically the code I call this now does nothing but open and close the dialog, with of course Python Ogre running in the main window (with nothing loaded)


04-01-2010 14:09:09


First I do not think this is a Python-Ogre issue after finding the solution.
Hopefully this will be helpful to others to avoid the time suck I went through. I found looking through the command line I was getting an "Error: Cannot initialize OLE". I did some googling and found this seems to sometimes happen in wxPython programs.

I compared my code to the demo_wx provided and began to comment out lines that did not match rerunning each time. I found that I was using the opencv ctypes_opencv module to do some image manipulation whos imports
"from ctypes_opencv.cxcore import cvCreateImageHeader, cvCreateImage, cvSplit, cvMerge" caused the OLE issue when using wxPython.

I pushed this import into the function which used the code and removed it as a module level import and this removed both the OLE error and the hanging issue.