Handling Com Events in Python (was Python and Windows Scripting Host)

Alex Martelli alex at magenta.com
Wed Aug 9 18:15:28 EDT 2000


"Syver Enstad" <syver.enstad at sensewave.com> wrote in message
news:8msc1g$omm$1 at troll.powertech.no...
> ..... (On handling Com events in python) Alex Martelli)
> > Not trivial.
>
> I thought it was pretty once I used DispatchWithEvents (thanks Mark H.)
and

Hmm, yes, but that mixes up the object you're automating with the
one that's receiving/handling its events.  I find that somewhat
unpleasant/untrivial.

> looked at the file lying in gen_py folder. After you have run gen_py look
at
> the file it has created that lies in the gen_py folder.
> Open this file to find the required method signature and copy this to your
> class.
> (See Hammond, Robinson, Python Programming on Win32, Chapter 12, page 200,
> 201, 202)
>
> The only problem I have here is that OnDocumentComplete (the most
> interesting method) won't compile because the "defaultNamedNotOptArg"
label
> is unknown to Python. I don't know which module this is located in. Could
> anyone help me out here?

Every file built by genpy has the following lines towards the start:

# The following 3 lines may need tweaking for the particular server
# Candidates are pythoncom.Missing and pythoncom.Empty
defaultNamedOptArg=pythoncom.Missing
defaultNamedNotOptArg=pythoncom.Missing
defaultUnnamedArg=pythoncom.Missing


Alex






More information about the Python-list mailing list