[python-win32] error: 'CoInitialize not found'

Solomon.Zewdie.Altek at zf.com Solomon.Zewdie.Altek at zf.com
Mon Sep 29 16:41:20 CEST 2008


Hi,
is someone among you guys out there familier with this kind of error message or rather knows the cause and the solution?:
 
"  File "F:\2_4_2\lib\site-packages\win32com\client\dynamic.py", line 78, in _GetGoodDispatch 
pywintypes.com_error: (-2147221008, 'CoInitialize not found.', None, None) "
 
 
What i am trying to do is: 
- instancing a class B (which i would like to use as an excel api) in class A
- creating an object of this class(B) and than
- using its Methods(like opening excel files, etc...)
 
 
Code in Class A:
...
   classB_obj = classB (InputFile,True,1)
   classB_obj.startExcel()
...
 
Code in Class B:
..
    def __init__(self, filename=None, visible, sheet):

       self.xlapp = win32com.client.dynamic.Dispatch("Excel.Application")
       self.workbook = xlFile = self.xlapp.Workbooks.Open(filename)
       self.xlapp.visible = visible
       self.worksheet = self.xlapp.Sheets(sheet) 
       ...
 
    def startExcel(self):
       ...
 
 
Unfortunately it doesn't work.
I have tested Class B stand a lone and it works....
So the problem seems to be somehow in the interaction between class A and Class B.
 
 
I am thankful for every suggestion and help!!!
 
Solomon
 
 


More information about the python-win32 mailing list