[python-win32] how do I sink Mscomm32 events?
Tue Apr 8 17:26:39 EDT 2003
After studying everything I can find via google on python-win32,
mscomm32, and DispatchWithEvents, I've pieced together the following
>>> from win32com.client import DispatchWithEvents
>>> class CommEvents:
>>> com1 = DispatchWithEvents('MSCOMMLib.MSComm.1', CommEvents)
>>> com1.CommPort = 1
>>> com1.Settings = "115200,N,8,1"
>>> com1.PortOpen = 1
>>> com1.InputLen = 0
>>> com1.Handshaking = 2
>>> com1.RTSEnable = 1
>>> com1.Output = "ATDT555-1234" + chr(13)+'\n\n'
>>> print 'Event:', com1.CommEvent
There are no errors, and "ATDT555-1234" is sent to device attached
to my COM1 port, but I don't get any events. I'm expecting to see
some kind of output from the print in OnComm whenever a character
is received by the COM1 serial port. Must I do something to get the
dispatcher to run? (I'm quite COM illiterate) Are threads assumed
to exist or must I create them, enabled them, or unblock them?
More information about the Python-win32