threading and internet explorer com

James c00lways at
Thu Jan 27 18:21:35 EST 2005


i'm using python 2.4 with pywin32...
I've tried to use internet explorer control with a class.
it was fine until i decided to inherit thread for the class...

class domain01(threading.Thread):
	def __init__(self):

	def run(self): = win32com.client.Dispatch('InternetExplorer.Application.1') 
#this line gives error if i use .start(), but if i use .run.. no error... = 1
		print "running"

xyz = domain()

this is what i get:
Exception in thread Thread-23:
Traceback (most recent call last):
   File "C:\Python24\lib\", line 442, in __bootstrap
   File "C:\python2exe\", line 41, in run
   File "C:\python2exe\", line 56, in dologin'InternetExplorer.Application.1')
   File "C:\Python24\Lib\site-packages\win32com\client\", 
line 95, in Dispatch
     dispatch, userName = 
   File "C:\Python24\Lib\site-packages\win32com\client\", line 
91, in _GetGoodDispatchAndUserName
     return (_GetGoodDispatch(IDispatch, clsctx), userName)
   File "C:\Python24\Lib\site-packages\win32com\client\", line 
79, in _GetGoodDispatch
     IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, 
com_error: (-2147221008, 'CoInitialize has not been called.', None, None)

but if i run:
xyz = domain()

##no error! it's weird....

anyone know how to solve this problem?

thank you :)

best regards,


More information about the Python-list mailing list