[Python-de] Probleme mit win32com.client / com-objekt hat property, das als methode dargestellt ist / wie weise ich nun Werte zu ?
Stefan Mallepell
steve at syso.ch
Mi Feb 14 19:37:00 CET 2007
Hallo
Ich sollte noch ultradringend eine Schnittstelle in ein ERP System
erstellen (ja ich bin viel, viel zu spät dran ...). Jetzt macht mir
win32com.client Probleme.
Die ERP SW stellt einen COM Server zur Verfügung, auf den ich als Client
aus Python zugreifen sollte. Die Instanzierung des COM Objekts geht tip
top. Vgl. PythonWin Output:
* >>> import win32com.client
* >>> o = win32com.client.Dispatch("OLE_VK.VK")
Das Aufrufen von Methoden funktioniert:
* >>> 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>>
Da die Properties des Objekts leider als "Methoden" erscheinen (vgl.
Unten Ausschnitt aus generiertem Interface), kann ich nun den Properties
keine Werte zuweisen. Ich erhalte immer einen Syntax Error ...
* >>> o.Table.AsCurrencybyName("DKO","AUF_NR") = 268
* Traceback ( File "<interactive input>", line 1
* SyntaxError: can't assign to function call (<interactive input>,
* line 1)
Gibt es eine Lösung für dieses Problem? Falls ja, was muss ich sonst
noch besonders beachten (Werteübergabe von Typ Integer, String,
Currency, Boolean, DateTime, Variant, Double).
Tja ich bin nicht wirklich der Python Crack und muss jetzt eingestehen,
dass ich mich etwas übernommen habe ... Wenn mir jemand helfen kann, bin
ich mega froh ;-)
Danke und Gruss
Stefan
# The method SetAsBooleanbyName is actually a property, but must be
used as a method to correctly pass the arguments
def SetAsBooleanbyName(self, _tableID=defaultNamedNotOptArg,
_fldID=defaultNamedNotOptArg, arg2=defaultUnnamedArg):
return self._oleobj_.InvokeTypes(3, LCID, 4, (24, 0), ((8, 1),
(8, 1), (11, 1)),_tableID
, _fldID, arg2)
# The method SetAsBooleanbyNo is actually a property, but must be
used as a method to correctly pass the arguments
def SetAsBooleanbyNo(self, _tableID=defaultNamedNotOptArg,
_fldID=defaultNamedNotOptArg, arg2=defaultUnnamedArg):
return self._oleobj_.InvokeTypes(13, LCID, 4, (24, 0), ((8, 1),
(3, 1), (11, 1)),_tableID
, _fldID, arg2)
# The method SetAsCurrencybyName is actually a property, but must
be used as a method to correctly pass the arguments
def SetAsCurrencybyName(self, _tableID=defaultNamedNotOptArg,
_fldID=defaultNamedNotOptArg, arg2=defaultUnnamedArg):
return self._oleobj_.InvokeTypes(4, LCID, 4, (24, 0), ((8, 1),
(8, 1), (6, 1)),_tableID
, _fldID, arg2)
# The method SetAsCurrencybyNo is actually a property, but must be
used as a method to correctly pass the arguments
def SetAsCurrencybyNo(self, _tableID=defaultNamedNotOptArg,
_fldID=defaultNamedNotOptArg, arg2=defaultUnnamedArg):
return self._oleobj_.InvokeTypes(14, LCID, 4, (24, 0), ((8, 1),
(3, 1), (6, 1)),_tableID
, _fldID, arg2)
# The method SetAsDateTimebyName is actually a property, but must
be used as a method to correctly pass the arguments
def SetAsDateTimebyName(self, _tableID=defaultNamedNotOptArg,
_fldID=defaultNamedNotOptArg, arg2=defaultUnnamedArg):
return self._oleobj_.InvokeTypes(19, LCID, 4, (24, 0), ((8, 1),
(8, 1), (7, 1)),_tableID
, _fldID, arg2)
# The method SetAsDateTimebyNo is actually a property, but must be
used as a method to correctly pass the arguments
def SetAsDateTimebyNo(self, _tableID=defaultNamedNotOptArg,
_fldID=defaultNamedNotOptArg, arg2=defaultUnnamedArg):
return self._oleobj_.InvokeTypes(20, LCID, 4, (24, 0), ((8, 1),
(3, 1), (7, 1)),_tableID
, _fldID, arg2)
# The method SetAsDoublebyName is actually a property, but must be
used as a method to correctly pass the arguments
def SetAsDoublebyName(self, _tableID=defaultNamedNotOptArg,
_fldID=defaultNamedNotOptArg, arg2=defaultUnnamedArg):
return self._oleobj_.InvokeTypes(5, LCID, 4, (24, 0), ((8, 1),
(8, 1), (5, 1)),_tableID
, _fldID, arg2)
# The method SetAsDoublebyNo is actually a property, but must be
used as a method to correctly pass the arguments
def SetAsDoublebyNo(self, _tableID=defaultNamedNotOptArg,
_fldID=defaultNamedNotOptArg, arg2=defaultUnnamedArg):
return self._oleobj_.InvokeTypes(15, LCID, 4, (24, 0), ((8, 1),
(3, 1), (5, 1)),_tableID
, _fldID, arg2)
# The method SetAsIntegerbyName is actually a property, but must be
used as a method to correctly pass the arguments
def SetAsIntegerbyName(self, _tableID=defaultNamedNotOptArg,
_fldID=defaultNamedNotOptArg, arg2=defaultUnnamedArg):
return self._oleobj_.InvokeTypes(1, LCID, 4, (24, 0), ((8, 1),
(8, 1), (3, 1)),_tableID
, _fldID, arg2)
# The method SetAsIntegerbyNo is actually a property, but must be
used as a method to correctly pass the arguments
def SetAsIntegerbyNo(self, _tableID=defaultNamedNotOptArg,
_fldID=defaultNamedNotOptArg, arg2=defaultUnnamedArg):
return self._oleobj_.InvokeTypes(11, LCID, 4, (24, 0), ((8, 1),
(3, 1), (3, 1)),_tableID
, _fldID, arg2)
# The method SetAsStringbyName is actually a property, but must be
used as a method to correctly pass the arguments
def SetAsStringbyName(self, _tableID=defaultNamedNotOptArg,
_fldID=defaultNamedNotOptArg, arg2=defaultUnnamedArg):
return self._oleobj_.InvokeTypes(2, LCID, 4, (24, 0), ((8, 1),
(8, 1), (8, 1)),_tableID
, _fldID, arg2)
# The method SetAsStringbyNo is actually a property, but must be
used as a method to correctly pass the arguments
def SetAsStringbyNo(self, _tableID=defaultNamedNotOptArg,
_fldID=defaultNamedNotOptArg, arg2=defaultUnnamedArg):
return self._oleobj_.InvokeTypes(12, LCID, 4, (24, 0), ((8, 1),
(3, 1), (8, 1)),_tableID
, _fldID, arg2)
# The method SetAsVariantbyName is actually a property, but must be
used as a method to correctly pass the arguments
def SetAsVariantbyName(self, _tableID=defaultNamedNotOptArg,
_fldID=defaultNamedNotOptArg, arg2=defaultUnnamedArg):
return self._oleobj_.InvokeTypes(6, LCID, 4, (24, 0), ((8, 1),
(8, 1), (12, 1)),_tableID
, _fldID, arg2)
# The method SetAsVariantbyNo is actually a property, but must be
used as a method to correctly pass the arguments
def SetAsVariantbyNo(self, _tableID=defaultNamedNotOptArg,
_fldID=defaultNamedNotOptArg, arg2=defaultUnnamedArg):
return self._oleobj_.InvokeTypes(16, LCID, 4, (24, 0), ((8, 1),
(3, 1), (12, 1)),_tableID
, _fldID, arg2)
# The method SetTextDetail is actually a property, but must be used
as a method to correctly pass the arguments
def SetTextDetail(self, _dtxttyp=defaultNamedNotOptArg,
arg1=defaultUnnamedArg):
return self._oleobj_.InvokeTypes(10, LCID, 4, (24, 0), ((3, 1),
(8, 1)),_dtxttyp
, arg1)
# The method SetTextHeader is actually a property, but must be used
as a method to correctly pass the arguments
def SetTextHeader(self, _htxttyp=defaultNamedNotOptArg,
_hdoktyp=defaultNamedNotOptArg, arg2=defaultUnnamedArg):
return self._oleobj_.InvokeTypes(9, LCID, 4, (24, 0), ((3, 1),
(3, 1), (8, 1)),_htxttyp
, _hdoktyp, arg2)
Mehr Informationen über die Mailingliste python-de