Wong, Shin Guey schrieb:
> I am still new to comtypes. Now, I am facing some problems on
> accessing com dll with propput and propget. All other methods is
> working fine as along as it it not a propput and propget methods. How
> do I access those methods, am I doing something wrong?
>
Sorry for this too late reply - I must somehow have overlooked this all the
time.
There is probably a problem with property accesses that use [in, out]
parameters.
Is the com object that you use publicely available somewhere?
> Here is the python console I use to call those methods:
> ===================================================================
>>>> from comtypes.client import CreateObject st =
>>>> CreateObject("vbSiThermalCOM.clsVBSiThermalClass")
>>>> st.HeadCount
> <comtypes.bound_named_property object at 0x00C772F0>
>>>> st.HeadCount = 1
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "c:\python25\lib\site-packages\comtypes\__init__.py", line 238, in
> __setattr__
> value)
> TypeError: __set__() takes exactly 2 arguments (3 given)
>>>> st.CommPort(1)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> TypeError: 'int' object is not callable
>>>> st.CommPort
> 0
>>>> st.CommPort[1]
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> TypeError: 'int' object is unsubscriptable
> ===================================================================
>
>
> Here is the generated python script by comtypes:
> ===================================================================
> COMMETHOD([dispid(1745027074), 'propput'], HRESULT, 'HeadCount',
> ( ['in', 'out'], POINTER(c_short), 'None' )),
COMMETHOD([dispid(1745027074), 'propget'], HRESULT, 'HeadCount',
> ( ['retval', 'out'], POINTER(c_short), 'None' )),
COMMETHOD([dispid(1745027073), 'propput'], HRESULT, 'CommPort',
> ( ['in', 'out'], POINTER(c_short), 'Head' ),
> ( ['in', 'out'], POINTER(c_short), 'None' )),
>
> ################################################################
> ## code template for _clsVBSiThermalClass implementation ##class
> _clsVBSiThermalClass_Impl(object):
> ## def _get(self):
> ## '-no docstring-'
> ## #return
> ## def _set(self):
> ## '-no docstring-'
> ## CommPort = property(_get, _set, doc = _set.__doc__)
> ##
> ## def Disconnect(self):
> ## '-no docstring-'
> ## #return
> ##
> ## def GetPV(self):
> ## '-no docstring-'
> ## #return Head, <unnamed>
> ##
> ## def SetSV(self):
> ## '-no docstring-'
> ## #return Head, NewSetPoint, <unnamed>
> ##
> ## def GetSV(self):
> ## '-no docstring-'
> ## #return Head, <unnamed>
> ##
> ## @property
> ## def Connected(self):
> ## '-no docstring-'
> ## #return Head, <unnamed>
> ##
> ## def Connect(self):
> ## '-no docstring-'
> ## #return
> ##
> ## def _get(self):
> ## '-no docstring-'
> ## #return
> ## def _set(self):
> ## '-no docstring-'
> ## CommDevice = property(_get, _set, doc = _set.__doc__)
> ##
> ## def _get(self):
> ## '-no docstring-'
> ## #return
> ## def _set(self):
> ## '-no docstring-'
> ## HeadCount = property(_get, _set, doc = _set.__doc__)
> ##
> ===================================================================
>
--
Thanks,
Thomas
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
comtypes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/comtypes-users