win32com -- the IE-events mistery continues

Mark Hammond MarkH at ActiveState.com
Mon Aug 14 03:53:40 EDT 2000


"Alex Martelli" <alex at magenta.com> wrote in message
news:8n5q4v02dlu at news2.newsguy.com...

> being a COM object, is naturally subject to get and putref
> (not get and put).  I was unable to use the putref from Python;
> apparently Python always turns the attribute-setting into a put,
> and if a putref is needed, one's SOL.  In this case I fixed it
> by adding a put for the property, parallel to its putref, to the
> pluggable-listener interface; but how does one putref in the
> general case?


If you have makepy support for the object, it creates a "Set" method.
Without makepy support you are forced to use Invoke() manually.

> Anyway -- here's the Python code I ended up with (please
> excuse any random linebreaks my newsreader may
> insert here or there...).  I've worked at as low a level as
> came to mind, implementing _invoke_ in my Python

When I get a chance I will try and repro this in the MSVC debugger.
If I can confirm that we are seeing the event at IDispatch::Invoke(),
but it is not getting down to Python code, then it is something that
can easily be fixed.

Another alternative is to wrap the event handler in a debugging
policy.  This will allow you see if there is an error in the .py code
preventing Python seeing it.

Mark.






More information about the Python-list mailing list