[python-win32] Strange/impossible Python COM interface behavior
Richard Bell
rbell01824 at earthlink.net
Wed Jul 4 18:04:12 CEST 2007
In my continued work on a COM automation interface for IE I've encountered a
strange/impossible Python behavior. Here's what appears to be the offending
code:
----- code -----
nodes = self.DomGetNListFilterValue(node, tags, properties, value,
intoFrames, errorFlag, message)
print 'DomGetANodeFilterValue', nodes
#DomGetANodeFilterValue [<win32com.gen_py.Microsoft HTML Object
Library.DispHTMLInputElement instance at 0x34839088>]
print 'DomGetANodeFilterValue', len(nodes)
#DomGetANodeFilterValue 1
print 'DomGetANodeFilterValue[%s]'%nodes[0]
#DomGetANodeFilterValue[]
if len(nodes) == 1:
print 'DomGetANodeFilterValue[%s]'%(nodes[0])
#DomGetANodeFilterValue[]
#but under debugger,
#nodes[0]
#<win32com.gen_py.Microsoft HTML Object
Library.DispHTMLInputElement instance at 0x34839088>
return nodes[0]
----- end code -----
The call to DomGetNListFilterValue returns a list with 1 object per the
print statements (the comments contain the print statements output). But an
attempt to reference the object returns nothing per the following print
statement. Curiously, setting a break point and referencing nodes[0] DOES
return the correct value!?! I've never seen this kind of behavior. Does
anyone have any clues?
Thanks for any help.
Regards,
Richard
More information about the Python-win32
mailing list