Christian K. schrieb:
> sorry. I forgot the attachment.
>
> Christian
>
>
>
> ------------------------------------------------------------------------
>
> import unittest
> import comtypes.client
>
> import wx
>
> class EventHandler(object):
> """Instances are called when the COM object fires events."""
> def __init__(self, view, name):
> self.view = view
> self.name = name
>
> def __call__(self, this, *args, **kw):
> self.view.write(unicode("Event %s fired" % self.name, args, kw))Here is the problem: ^^^^^^^^^^^^ You are calling the unicode function with three arguments ;-). Unfortunately, by default you do not get a traceback that points out the problem. You can enable the tracebacks with these lines at the top of your script: import logging logging.basicConfig(level=logging.WARNING) BTW: I see that you are using an old version of comtypes (in recent versions the CreateObject function does not accept a 'sink' argument any longer; you have to setup the events by calling comtypes.client.GetEvents function, and keep the returned object as long as you want to receive the events). Unfortunately I have never released a newer comtypes, but you can get it with 'easy_install comtypes==dev', if you have svn installed. Thomas PS: I'll attach a working script that I have made, it connects to internet explorer which is my favorite com client for testing (although I don't use it for browsing).
x.py
Description: application/python
_______________________________________________ Python-win32 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-win32
