threads and COM

Darrell news at dorb.com
Wed Sep 1 20:49:44 EDT 1999


This program crashes python.
And removing the CoInitialize() gives
com_error: (-2147221008, 'CoInitialize has not been called.', None, None)
Other combinations include "tstate mix-up" errors.

WGIDGEN is setup for apartment threading.
Any ideas ?
Don't tell me the main thread must be owned by COM.

from threading import Thread
import pythoncom
from uuid import WGIDGEN

def uuid_gen():
    pythoncom.CoInitialize()
    x=WGIDGEN()
    y=x.GenWGID()
    print "UUID IS ", y

t1 = Thread(target=uuid_gen)
t1.start()

--
--Darrell






More information about the Python-list mailing list