[python-win32] win32com: Problem with passing short integer?
Einar Sørheim
einar at ife.no
Tue Jan 9 11:08:02 CET 2007
Hi,
I have a set of com dlls that I have a hard time to get working together
with python.
In this particular case everything seems to work nicely until I make a
function call with
a short int as input argument. The following error message is given:
Traceback (most recent call last):
File "mtupvt.py", line 123, in ?
o.Flash(101300,290)
File "mtupvt.py", line 81, in Flash
self.DisplayFLashOut()
File "mtupvt.py", line 100, in DisplayFLashOut
mix.ComponentName(i)
File "<COMObject <unknown>>", line 2, in ComponentName
pywintypes.com_error: (-2147352573, 'Member not found.', None, None)
The interface code is generated automatically in the 'gen_py' folder,
the interface contains only
vtable-entries, I am not sure what this means, however for this
particular function it looks like:
IFlashPhase_vtables_dispatch_ = 0
IFlashPhase_vtables_ = [
(( 'NumberofComponents' , 'pVal' , ), 1610678272, (1610678272, (), [
(16386, 10, None, None) , ], 1 , 2 , 4 , 0 , 12 , (3, 0, None, None) , 0
, )),
(( 'NumberofComponents' , 'pVal' , ), 1610678272, (1610678272, (), [
(2, 1, None, None) , ], 1 , 4 , 4 , 0 , 16 , (3, 0, None, None) , 0 , )),
(( 'ComponentName' , 'i' , 'pVal' , ), 1610678274, (1610678274, (),
[ (2, 1, None, None) ,
(16392, 10, None, None) , ], 1 , 2 , 4 , 0 , 20 , (3, 0,
None, None) , 0 , )),
(( 'ComponentName' , 'i' , 'pVal' , ), 1610678274, (1610678274, (),
[ (2, 1, None, None) ,
(8, 1, None, None) , ], 1 , 4 , 4 , 0 , 24 , (3, 0, None,
None) , 0 , )),
The calling code is roughly:
self.flashmodule =
win32com.client.gencache.GetModuleForProgID("PvtsFlash.FlashPhase")
mix = win32com.client.Dispatch(self.flashout.Mixture)
print mix.NumberofComponents
nphases = self.flashout.NumberofPhases
print nphases
print 'mix',mix
i=1
mix._FlagAsMethod("ComponentName")
mix.ComponentName(i)
When using Pythonwin and its debugger, the ComponentName method pops up
using autocompletion, but I can't seem
to call it correctly in any way, ideas on how to fix this?
I have sample programs doing the same in c++ and VB and it works there.
Have tried comtypes but then stumbles on another problem
earlier in the program.
regards
Einar Sørheim
More information about the Python-win32
mailing list