We have some equipment that communicates at 57600 baud RS232. The path from the PC is USB to a Phillips USB hub, then off of that a TUSB3410 USB/Serial converter. The driver for the 3410 chip creates a "normal" comm port (like COM3). There is a C++ program that has no problem talking to the equipment, but two Python programs have trouble. One is a big, scary, controller program, and the other, since that is the one I'm having trouble with, is a while() loop.
The while loop program seems to be able to open and close the serial port all day. It also seems to be able to open, send "blahblahblah", and close the port for the same length of time. But writing anything to the port quickly (not always right away...like maybe 5-6 iterations through the loop?) causes the win32file.CloseHandle(self.hComPort) statement in the 'def close(self)' function of the serialwin32.py file of the pySerial package to hang for a few seconds, then return. The next open() attempt fails with the 'could not open port: (995, 'CreateFile', 'The I/O operation has been aborted because of either a thread exit or an application request.') exception. The failure mode with the large program is it opens the port successfully completes a bunch of back and forth talking, then hangs for a few seconds when the port is closed, and then can't reopen the port. It never seems to fail in the middle of a bunch of reads and writes, but only when/after the port is closed. It can also run for the better part of an hour with no problems then all of a sudden... Like I said, the C++ program never fails. I've looked at the settings in the C++ program, and in the serialwin32.py file and tried to set them the same as best I can, but no luck. Digging into the win32all stuff gets me lost quite quickly. I see all of the settings, but have no idea what to try. This is all on WinXP, Python 2.4.1, the latest pySerial and win32all. Does this ring any bells with anyone? Thanks! Bob -- http://mail.python.org/mailman/listinfo/python-list