Len Remmerswaal schrieb:
> On 24-Aug-07 21:08, [EMAIL PROTECTED] wrote:
>> I assume the event is handled by TWO receivers:  The first is the one
>> created by ShowEvents(), the second one is your object that has the
>> PLCSimStateChanged method you quoted above.
>>
>> Returning 0 from the PLCSimStateChanged method is correct (the return
>> value is a HRESULT which is a 32-bit integer value, 0 is S_OK which
>> means everything worked).  In this case, only the method in the event
>> handler of ShowEvents raised the exception; in the second case where you
>> returned 'None' two exceptions are raised.
>>
>> Looking at the code it seems that some code in the comtypes.client._events
>> module is buggy: can you please change line 164 from this code:
>>
>>             mth = getattr(sink, name, lambda self, this, *args: None)
>>
>> to this code:
>>
>>             mth = getattr(sink, name, lambda self, this, *args: 0)
>>
>> and try again?
>>
>> Thomas
>>   
> That change did not give me anything visibly different.
> However, your remark about ShowEvents set me thinking, and I changed the 
> following:
> after comtype.client._events.py, line 197:
> 
>             print "Event %s(%s)" % (name, ", ".join([repr(a) for a in args]))
> 
> I added a line
> 
>             return 0
> 
> to make the generic event handler return S_OK instead of None. No error 
> messages any more. Perhaps for 0.3.2.1? :-)

That is exactly the correct fix.  Thanks, and sorry for the confusion about
my fix.

The next release will be named 0.3.3, and will be out shortly.

Thomas


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to