Srikanth Rokkam
Srikanth Rokkam

Reputation: 51

'CoInitialize has not been called' When call a function with parameters by Object

I am trying to call a ExecutionStart function by the Object TestSessionProjectObj. When i pass and try to print the object it shows the below error CoIntilaization.

File "C:\Python27\lib\threading.py", line 754, in run self.__target(*self.__args, **self.__kwargs) File"C:/AI/AutomationDesk/API/Scripting_Python/MITETestSessionProjectExecution.py", line 52, in ExecutionStart

print TestSessionProjectObj.Name

File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 529, in getattr

ret = self._oleobj_.Invoke(retEntry.dispid,0,invoke_type,1)

com_error: (-2147221008, 'CoInitialize has not been called.', None, None)

Upvotes: 3

Views: 8831

Answers (1)

Vikas Periyadath
Vikas Periyadath

Reputation: 3186

Just try by adding this :

import pythoncom

pythoncom.CoInitialize()

.....

Upvotes: 4

Related Questions