2

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)

Manoj Jadhav
  • 1,270
  • 1
  • 15
  • 23

1 Answers1

4

Just try by adding this :

import pythoncom

pythoncom.CoInitialize()

.....
Vikas Periyadath
  • 3,088
  • 1
  • 21
  • 33