[python-win32] How to assign a value to a property which must be used as a method to correctly pass the arguments
Stefan Mallepell
steve at syso.ch
Thu Feb 15 09:51:53 CET 2007
Hi
I have a "show stopper" with the win32com module. The com object I have
to write a client to, has a interface where the properties show as
methods (see interface at the end of this mail)
(# The method AsCurrencybyName is actually a property, but must be
used as a method to correctly pass the arguments)
When I try to assign a value to a object property I get a SyntaxError.
See output of python win below.
Is there a workaround ? What can I do?
Best Regards
Stefan
* PythonWin 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit
* (Intel)] on win32.
* >>> import win32com.client
* >>> o = win32com.client.Dispatch("OLE_VK.VK")
* >>> o.SetClient(7777)
* True
* >>> o.SetApplicationID(6)
* True
* >>> o.NewHeader
* <bound method IVK.NewHeader of <win32com.gen_py.ABEA Business-Object
* Verkauf.IVK instance at 0x19950648>>
* >>> o.Table.AsCurrencybyName("DKO","AUF_NR") = 268
* Traceback ( File "<interactive input>", line 1
* SyntaxError: can't assign to function call (<interactive input>,
* line 1)
* >>>
Interface:
# The method AsStringbyName is actually a property, but must be
used as a method to correctly pass the arguments
def AsStringbyName(self, _tableID=defaultNamedNotOptArg,
_fldID=defaultNamedNotOptArg):
# Result is a Unicode object - return as-is for this version of
Python
return self._oleobj_.InvokeTypes(2, LCID, 2, (8, 0), ((8, 1),
(8, 1)),_tableID
, _fldID)
More information about the Python-win32
mailing list