python1.5.2 + nt services + COM

Steven Scott Steven.Scott at Synchrologic.com
Fri Nov 9 15:14:48 EST 2001


> At 12:44 PM 11/9/01 -0500, Steven Scott wrote:
> ...
> >I'm not specifically using threads, although I am subclassing
> >win32serviceutil.ServiceFramework as per the ntservice 
> example that comes
> >with win32all...I don't know if it does something with 
> threads, but I'm led
> >to believe that it's so.
> ...
> 
> That's probably the reason it doesn't work.  See Appendix D of Python 
> Programming on Win32 for a good explanation of threading issues with 
> COM.  Or if you don't have the book, the short version is, 
> try calling:
> 
>          pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED)
> 
> at the beginning of the DoRun method (or if you'd prefer 
> apartment-threading instead of free-threading, call 
> pythoncom.CoInitialize() instead).  Also, you should call
> 
>          pythoncom.CoUninitialize()
> 
> at the end of the DoRun method.
> 

aha that seems to work
many thanks




More information about the Python-list mailing list