[python-win32] Outlook Event Freezes Python

Measure, Alex - BLS Measure.Alex at BLS.GOV
Thu Apr 8 16:36:27 CEST 2010


I'm trying to write a program that executes a print statement when a
NewInspector event occurs in Outlook. Whenever I initiate the event (by
double clicking an email) the Python program freezes and the new
inspector window won't appear until I "end task" the Python program. The
program runs fine if instead of a print statement I do a windows beep.
Anyone know what I'm doing wrong? I'm running python 2.6, outlook 2007,
and pywin build 214. My code is below.

import win32com.client
import winsound

class Events:
    def OnNewInspector(self,newinspector):
        # Freezes if I try to do a print statement but not if just a
beep
        # winsound.Beep(500,100)
        print 'New Inspector Generated'

application = win32com.client.GetActiveObject("Outlook.Application")
inspector_events =
win32com.client.WithEvents(application.Inspectors,Events) 

Thanks!
Alex



More information about the python-win32 mailing list