Reinhammar Maria schrieb:
> We get the following, less favourable response :o( Any advice is greatly 
> appreciated!!
> 
> Setting is python 2.5.2, windows xp professional SP3, SolidEdge V20 SP10, 
> comtypes 0.6
> 
> We have great success with comtypes interfacing other software like SmarTeam 
> (PDM/PLM software) and of course Excel and alike. :o)
> 
> Thnx
> 
> IDLE 1.2.2
>>>> import comtypes.client
>>>> foo = comtypes.client.CreateObject("SolidEdge.Application")
> # Generating comtypes.gen._8A7EFA3A_F000_11D1_BDFC_080036B4D502_0_1_0
> # Generating comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0
> # Generating comtypes.gen.stdole
> 
> Traceback (most recent call last):
>   File "<pyshell#2>", line 1, in <module>
>     foo = comtypes.client.CreateObject("SolidEdge.Application")
>   File "C:\Python25\lib\site-packages\comtypes\client\__init__.py",
> line 204, in CreateObject
>     return _manage(obj, clsid, interface=interface)
>   File "C:\Python25\lib\site-packages\comtypes\client\__init__.py",
> line 165, in _manage
>     obj = GetBestInterface(obj)
>   File "C:\Python25\lib\site-packages\comtypes\client\__init__.py",
> line 102, in GetBestInterface
>     mod = GetModule(tlib)
>   File "C:\Python25\lib\site-packages\comtypes\client\_generate.py",
> line 112, in GetModule
>     mod = _CreateWrapper(tlib, pathname)
>   File "C:\Python25\lib\site-packages\comtypes\client\_generate.py",
> line 188, in _CreateWrapper
>     mod = _my_import(fullname)
>   File "C:\Python25\lib\site-packages\comtypes\client\_generate.py",
> line 26, in _my_import
>     return __import__(fullname, globals(), locals(), ['DUMMY'])
>   File "C:\Python25\lib\site-packages\comtypes\gen
> \_8A7EFA3A_F000_11D1_BDFC_080036B4D502_0_1_0.py", line 3393, in <module>
>     ( ['in'], POINTER(_midlSAFEARRAY(c_char)), 'Accelerators' )),
>   File "C:\Python25\lib\site-packages\comtypes\safearray.py", line 18, in 
> _midlSAFEARRAY
>     sa_type = _make_safearray_type(itemtype)
>   File "C:\Python25\lib\site-packages\comtypes\safearray.py", line 52, in 
> _make_safearray_type
>     raise TypeError(itemtype)
> TypeError: <class 'ctypes.c_char'>
>>>>
> 

Please try this patch:

Index: comtypes/automation.py
===================================================================
--- comtypes/automation.py      (revision 493)
+++ comtypes/automation.py      (working copy)
@@ -747,6 +747,7 @@
     _vartype_to_ctype[v] = c
 _vartype_to_ctype[VT_INT] = _vartype_to_ctype[VT_I4]
 _vartype_to_ctype[VT_UINT] = _vartype_to_ctype[VT_UI4]
+_ctype_to_vartype[c_char] = VT_UI1
 
 
 try:


> 
> 
> Maria Reinhammar

-- 
Thanks,
Thomas


------------------------------------------------------------------------------
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to