Sounds like you may be using this on a Windows machine. <If> the code is functional, it is best practice to close the port first before openiing it. If due to an error, usually not syntax, the port will stay stuck open until the program is closed and reopened. I have used the Python serial port (serial.py?) with good results.
Paul Simon "Ron Eggler" <rondotegg...@tscheemail.com> wrote in message news:jp6gcj$1rij$1...@adenine.netfront.net... > Hoi, > > I'm trying to connect to a serial port and always get the error > "serial.serialutil.SerialException: Port is already open." whcih is > untrue. > I have no serial port open yet, my code looks like this: > #!/usr/bin/python > import time > import serial > > # configure the serial connections (the parameters differs on the device > # you are connecting to) > ser = serial.Serial( > port='/dev/ttyUSB0', > baudrate=19200, > parity=serial.PARITY_ODD, > stopbits=serial.STOPBITS_TWO, > bytesize=serial.SEVENBITS > ) > > ser.open() > > Why do I get this error? > > Thank you, > Ron > > --- Posted via news://freenews.netfront.net/ - Complaints to > n...@netfront.net --- -- http://mail.python.org/mailman/listinfo/python-list