[python-win32] cmp oleobj & instance with Python 2.6.1 et pywin32
Michel Claveau
mc at mclaveau.com
Wed Feb 4 15:18:56 CET 2009
Hi!
(sorry for my "bizzaroid" english)
I have a script who use DOM objects (COM-subobjects from
win32com.client.Dispatch('InternetExplorer.Application').
These objects are in instances properties. And, I compare with other
instances/python_objects.
e.g. a line like :
if form.conteneurcourant != containeur:
With Python 2.5, it's OK.
With Python 2.6.1 (who run with the genious Mark Hammond's python26.dll), I
have an error, if one of the two variables are not a COM object.
The traceback :
Traceback (most recent call last):
File "C:\Ponx\pluie\ex05-image.py", line 126, in <module>
utilisefiche()
File "C:\Ponx\pluie\ex05-image.py", line 40, in utilisefiche
image = fiche.element('IMG',cadre)
File "C:\Ponx\pluie\pluie.py", line 293, in __init__
if form.conteneurcourant != containeur:
File "C:\Python26\lib\site-packages\win32com\client\dynamic.py", line 205,
in __cmp__
return cmp(self._oleobj_, other)
TypeError: The Python instance can not be converted to a COM object
I solved the problem, by replace != by not(...is...) ; then, it's OK for
me.
But, I think than the error in cmp can affect others scripts developers.
It's for that what I publish this message.
@-salutations
--
Michel Claveau
More information about the python-win32
mailing list