[python-win32] error: 'CoInitialize not found'
Dahlstrom, Roger
rdahlstrom at directedge.com
Tue Sep 30 13:18:46 CEST 2008
If you didn't get the answer already, you need to call pythoncom.CoInitialize() prior to the code that is throwing an error,
probably put it right after init.
-----Original Message-----
From: python-win32-bounces+rdahlstrom=directedge.com at python.org [mailto:python-win32-bounces+rdahlstrom=directedge.com at python.org]
On Behalf Of Solomon.Zewdie.Altek at zf.com
Sent: Monday, September 29, 2008 10:41 AM
To: python-win32 at python.org
Subject: [python-win32] error: 'CoInitialize not found'
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
_______________________________________________
python-win32 mailing list
python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32
DISCLAIMER:
This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and
may contain legally privileged and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and
any attachments thereto, is strictly prohibited. If you have received this in error, please immediately notify
me and permanently delete the original and any copy of any e-mail and any printout thereof.
E-mail transmission cannot be guaranteed to be secure or error-free. The sender therefore does not accept
liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission.
NOTICE REGARDING PRIVACY AND CONFIDENTIALITY
Direct Edge ECN LLC may, at its discretion, monitor and review the content of all e-mail communications.
www.directedge.com
More information about the python-win32
mailing list