Menu

#32 Get The following error on create object

v1.0 (example)
open
nobody
None
5
2015-05-29
2015-05-29
No

as you can using the win32com i did not have any error

from win32com.client import DispatchEx,Dispatch
a = Dispatch('TD_appl.Application', clsctx=CLSCTX_LOCAL_SERVER | CLSCTX_ACTIVATE_64_BIT_SERVER)
a.CLSID
IID('{39AAEA35-F71F-11D2-BD59-00500400405B}')
a.Visible=True
a.Interactive=True
import comtypes.client

if i try to create or get the same object from comtype i get the following error

td_appl = CreateObject("{39AAEA36-F71F-11D2-BD59-00500400405B}",clsctx=CLSCTX_LOCAL_SERVER | CLSCTX_ACTIVATE_64_BIT_SERVER)

Generating comtypes.gen._F4503A16_F637_11D2_BD55_00500400405B_0_1_0

Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
td_appl = CreateObject("{39AAEA36-F71F-11D2-BD59-00500400405B}",clsctx=CLSCTX_LOCAL_SERVER | CLSCTX_ACTIVATE_64_BIT_SERVER)
File "C:\Python27\lib\site-packages\comtypes\client_init__.py", line 242, in CreateObject
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 11301, in <module>
( ['out'], POINTER(BSTR), 'weldType' )),
File "C:\Python27\lib\site-packages\comtypes__init__.py", line 315, in setattr
self._make_methods(value)
File "C:\Python27\lib\site-packages\comtypes__init__.py", line 653, in _make_methods
func = prototype(i + vtbl_offset, name, paramflags, self._iid</module>
)
TypeError: 'out' parameter 1 must be a pointer type, not BSTR</module></pyshell#10>

app = comtypes.client.GetActiveObject('TD_appl.Application')

Generating comtypes.gen._F4503A16_F637_11D2_BD55_00500400405B_0_1_0

Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
app = comtypes.client.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 14719, in <module>
( ['out'], POINTER(BSTR), 'weldType' )),
File "C:\Python27\lib\site-packages\comtypes__init__.py", line 315, in setattr
self._make_methods(value)
File "C:\Python27\lib\site-packages\comtypes__init__.py", line 653, in _make_methods
func = prototype(i + vtbl_offset, name, paramflags, self._iid</module>
)
TypeError: 'out' parameter 1 must be a pointer type, not BSTR</module></pyshell#7>

could you point me how to solve it ?

regards,
Matteo

Discussion


Log in to post a comment.