serial port frustrations on win32

Erik Myllymaki erik at
Mon Dec 3 03:03:46 CET 2001

I put together a script to move SMDR records from a phone system into a SQL
database. It works great on my win2k laptop but it doesn't work on the nt
server (4.0 sp6a) that it is going to ultimately run on.

I've narrowed it down to not getting past a waitformultipleobjects() call -
hangs indefintely. I took that function straight from the file in the win32\Demos folder of the standard install.

I ran and it works great on the win2k lapop, but once
again it hangs at the same point on the NT server(i won't include the whole

    def _ComPortThread(self):
        overlapped = OVERLAPPED()
        overlapped.hEvent = CreateEvent(None, 0, 0, None)
        while 1:
            # XXX - note we could _probably_ just use overlapped IO on the
win32file.ReadFile() statement
            # XXX but this tests the COM stuff!
            rc, mask = WaitCommEvent(self.handle, overlapped)
            if rc == 0: # Character already ready!
            rc = WaitForMultipleObjects([overlapped.hEvent, self.eventStop],
 -hangs here forever-

Any help appreciated.

Erik Myllymaki
erik at

More information about the Python-list mailing list