[python-win32] Greetings and win32 com events question

Tim Golden tim.golden at viacom-outdoor.co.uk
Thu Jan 27 09:40:33 CET 2005


[Robert Kaplan]

| I'm new to the mailing, so greetings all!

Welcome. As a word of warning, this is a relatively
low-activity list and I don't know what the overlap
is between this and the main python list. If you get
no response (or no solution) here, you might want
to try the Python list.

| I'm working on an application try to respond to events in Microsoft 
| Access using Python and win32com.

| class   AccessEvents
|     def OnActivate(self):
|         print "Hello from Access"
|         return 1
| 
| <snip>
|         self. ac = Dispatch ("Access.Application")
|         self. db = self. ac. NewCurrentDatabase ("d:\\pyhack\\foo")
|         self. fm = self. ac. CreateForm ()
|         self. ac. Visible = true
|         self. fm = DispatchWithEvents (self. fm, AcEvents)
| 
| blows out with
| 
|     self. fm = DispatchWithEvents (self. fm, AcEvents)
|   File 
| "D:\PYTHON22\Lib\site-packages\win32com\client\__init__.py", line 
| 258, in
|  DispatchWithEvents
|     clsid = disp_class.CLSID
| AttributeError: 'NoneType' object has no attribute 'CLSID'.

Well, it's not clear from your code, but the third
parameter to DispatchWithEvents should be a *class*
and not an *instance*. Since AcEvents isn't defined
anywhere within your code snippet, it's hard to
see which it is, but just in case...

That said, I can't for the life of me see why that
would raise the error you're showing, but first
things first.

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


More information about the Python-win32 mailing list