threaded COM server problem (does wxPython work in a thread ?)

Alexander Eisenhuth stacom at stacom-software.de
Fri Mar 7 08:04:32 CET 2003


sunita Gupta schrieb:
> 
>> =================
>> def run (configurationFile=None, excelComClient=None):
>>         pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED)
>>     gUIApp = myApp()
>>     gUIApp.MainLoop()
>>     pythoncom.CoUninitialize()
>>
>>
>> Regards
>> Alexander
>>
> 
> Doesn't wxPython want to be the top level thread while running?  I have 
> tried the same approach ( I was using a debug build of wxPython which 
> may have generated the particular error messages) and have gotten error 
> messages to this effect.
> 
> My solution was to spawn a new python process and have a threaded python 
> com server just wait for completion.  i.e. I used pipes for I/O between 
> the COM server and the python process.
> 
> I hope this helps.
> Brian
> 
AFAIK you can run wxPython in that thread, where you import the modules first, 
but I'm not 100 % sure of pitfalls. But my approach works for a couple of times, 
so it can't be totally wrong.

Maybe I've the time to ensure that wxPython is the problem and ask the community 
with a little test script.

Thank you for your approach with the pipes, I was thinking about similar things, 
maybe with pyro ...

Alexander






More information about the Python-list mailing list