Python and COM: a bug?

Gaetan Corneau Gaetan_Corneau at baan.com
Wed Nov 10 09:31:17 EST 1999


Hello,

I have encountered a weird problem a few times in the past months. I'm
testing COM server (written here) with Python, and it seems that there is
something wrong in the code that optimizes the calls to COM objects.
Sometimes (a very rare occurence) the wrong function gets called when I
access a property. Suppose I have object O with properties a (an int), b (a
date), c (a string), then

print O.b

would give me 
"Hello, world"

The error always seem to be off by one (in the same direction), but I'm not
absolutely sure about that.

And sometimes, I get something like that:

>>> Object
<COMObject <unknown>>
>>> P = Object.Parent # Parent is an attribute that is the object that
created the current object
>>> P
<method CDispatch.Parent of CDispatch instance at c5e780>
>>> P = Object.get_Parent()
>>> P
<COMObject <unknown>>
>>>

I didn't talk about those problems 'til now because they're very hard to
reproduce and describe. And I can't just send the components to a volunteer
who would try to find the problem, because he would need to install 417 Mb
of our software to recreate the environment :(

I have workarounds, but what really annoys me is that I'm still fighting a
couple of guys here to get Python accepted: they always ask "why don't you
just use VBScript?", and it's true that I don't have those problems ith
VBScript (because VBScript doesn't try to optimize calls).

I'll try to find what the problem is by tracing the Python code, but since
I'm not familiar with it, I don't expect to find the cause. At this point,
all I want to know is if I'm the only one with that kind of strange
behavior...


Thanks,
______________________________________________________
   Gaetan Corneau
   Software Developer (Quality Assurance Team)
   BaaN  Supply Chain Solutions  
   E-mail: Gaetan_Corneau at baan.com        
   Compuserve: Gaetan_Corneau at compuserve.com  
   ICQ Number: 7395494             
   Tel: (418) 266-8252          
______________________________________________________
"Profanity is the one language all programmers know best"





More information about the Python-list mailing list