win32com function<->propterty problem

Bernhard Reiter bernhard at alpha1.csd.uwm.edu
Fri Apr 30 00:26:34 EDT 1999


Controlling SPSS for windows with python here, I run into
the following problem:

My OLE object an instance of ISpssDataCells
should have an array as property. From the SPSS documentation:

    ValueAt Property
	Returns or sets the value of the current data cell or row/column label. 

    Syntax
	object.ValueAt (row,column) [=value]

    Settings
	row	Row index (Long)
	column	Column index (Long)
	value	Variant (String or Binary)


Python win32com provides that as a function.
And I can perfectly get the values like
	value=object.ValueAt(1,1)
but setting ist a problem:

>>> d
<win32com.gen_py.SPSS Pivot Table Type Library.ISpssDataCells>
>>> d.ValueAt
<method ISpssDataCells.ValueAt of ISpssDataCells instance at 1199f00>
>>> d.ValueAt(1,1)
>>> d.ValueAt(1,1)=123
Error pulling apart exceptionTraceback (innermost last):
  File "C:\Python\Pythonwin\pywin\framework\interact.py", line 345, in keyhandler_enter
    message, (filename, lineno, offset, text) = exc_value
ValueError: unpack sequence of wrong size
SyntaxError: can't assign to function call


The Python Com Browser shows me, that there are two entries in
the Registered Spss Pivot Table Type Library, ISpssDataCells as
function:
    ValueAt - Function
	Dispatch ID=26
	Named Params ='row,col'
	Return Type ='Variant'
	Argument = 'Integer 4 (Flags=1)'
	Argument = 'Integer 4(Flags=1)'
	Function Kind ='Dispatch'
	Invoke Kind = 'Property Get'
	Number Optimal Params=0
    ValueAt - Function
	Dispatch ID=26
	Named Params ='row,col'
	Return Type ='Void'
	Argument = 'Integer 4 (Flags=1)'
	Argument = 'Integer 4(Flags=1)'
	Argument = 'Variant (Flags=1)'
	Function Kind ='Dispatch'
	Invoke Kind = 'Property Put'
	Number Optimal Params=0

Okay, python seems to know about both possibilities, but how do
I use them?

advaTHANKnce
	Bernhard





More information about the Python-list mailing list