[Tutor] Multithreading and COM Objects

Gooch, John John.Gooch at echostar.com
Fri Oct 29 17:39:46 CEST 2004


Here is some info and a question.
First the information:
	What I discovered recently discovered was that to access MS Windows
COM objects from within threads, I had to import the pythoncom module, and
then called 'pythoncom.CoInitialize()' at the beginning of each thread. It
works like a charm, whereas before each thread would spit out cryptic errors
that basically said "Connection failed" when doing a 'GetObject' call to get
a COM object.

Now the question:
	I am always concerned with performance and resources. I see I am
getting a reference to a COM object now, and I am wondering if I need to do
an resource cleanup in each thread after it is done with the COM object(s).
The two situations that apply to my current project are the 'GetObject'
reference, and the 'win32api.RegConnectRegistry' reference.



John A. Gooch
Systems Administrator
IT - Tools
EchoStar Satellite L.L.C.
9601 S. Meridian Blvd.
Englewood, CO  80112
Desk: 720-514-5708 


More information about the Tutor mailing list