pySerial Windows write problem

Peter Hansen peter at engcorp.com
Thu Jul 28 21:46:32 EDT 2005


Bob Greschke wrote:
> I didn't write the C++ program, but it looks like it never closes the serial 
> port.  It opens it when it starts up, then keeps it open until it quits. 
> Tsk tsk tsk.  Sloppy.  Maybe they did that to cover up this problem. :)

Actually, I'm curious why you don't do the same.  I'd call it very 
unusual (in my experience) to have a program open and close a serial 
port repeatedly.  Among other things, this means that the DSR/DTR lines 
are toggling high and low repeatedly, and that alone could cause 
undesirable behaviour in certain devices.

In none of my own serial-based programs (perhaps a few dozen such to 
date) have I ever opened and closed a port other than at startup and 
shutdown (just as your C++ program does).  Unless you've got a good 
reason to do otherwise, if this solves your problem it's certainly the 
most direct approach to do so.

-Peter



More information about the Python-list mailing list