#22 Crash using the GetActiveObject,CreateObject

open
nobody
None
5
2014-02-19
2012-09-12
Matteo Boscolo
No

when I try to run this code:
from comtypes.client import GetActiveObject,CreateObject
td = GetActiveObject('TD_Appl.Application')

I got the following error:
Traceback (most recent call last):
File "C:\d\OmniaSolutions\Programming\EclipseWorkSpace\OpenErpPlmClient\plmintegration\Integrations\Cad\Thinkdesign\integration.py", line 1973, in <module>
test4()
File "C:\d\OmniaSolutions\Programming\EclipseWorkSpace\OpenErpPlmClient\plmintegration\Integrations\Cad\Thinkdesign\integration.py", line 1950, in test4
print "Result:",GerPropValue2('DOCNAME')
File "C:\d\OmniaSolutions\Programming\EclipseWorkSpace\OpenErpPlmClient\plmintegration\Integrations\Cad\Thinkdesign\integration.py", line 1960, in GerPropValue2
ent=_getCurrentEnt()
File "C:\d\OmniaSolutions\Programming\EclipseWorkSpace\OpenErpPlmClient\plmintegration\Integrations\Cad\Thinkdesign\integration.py", line 1956, in _getCurrentEnt
td = GetActiveObject('TD_Appl.Application')
File "C:\Python27\lib\site-packages\comtypes\client\__init__.py", line 183, in GetActiveObject
return _manage(obj, clsid, interface=interface)
File "C:\Python27\lib\site-packages\comtypes\client\__init__.py", line 188, in _manage
obj = GetBestInterface(obj)
File "C:\Python27\lib\site-packages\comtypes\client\__init__.py", line 110, in GetBestInterface
mod = GetModule(tlib)
File "C:\Python27\lib\site-packages\comtypes\client\_generate.py", line 112, in GetModule
mod = _CreateWrapper(tlib, pathname)
File "C:\Python27\lib\site-packages\comtypes\client\_generate.py", line 188, in _CreateWrapper
mod = _my_import(fullname)
File "C:\Python27\lib\site-packages\comtypes\client\_generate.py", line 26, in _my_import
return __import__(fullname, globals(), locals(), ['DUMMY'])
File "C:\Python27\lib\site-packages\comtypes\gen\_F4503A16_F637_11D2_BD55_00500400405B_0_1_0.py", line 160, in <module>
( ['in'], POINTER(_midlSAFEARRAY(POINTER(c_int))), 'pCvBound' ),
File "C:\Python27\lib\site-packages\comtypes\safearray.py", line 18, in _midlSAFEARRAY
sa_type = _make_safearray_type(itemtype)
File "C:\Python27\lib\site-packages\comtypes\safearray.py", line 52, in _make_safearray_type
raise TypeError(itemtype)
TypeError: <class 'comtypes._safearray.LP_c_long'>
DEBUG:comtypes:Calling CoUnititialize()
DEBUG:comtypes:CoUnititialize() done.

regards,
Matteo

Discussion