Code works on Win7x64 but not on Debian or CentOS 5
Brought to you by:
cliechti
I have the following simple code:
import serial
ser = serial.Serial('/dev/ttyUSB0', baudrate = 9600, timeout=.25)
ser.open
ser.write(chr(0xFF) + chr(0) + chr(3))
ser.close
The device is a USB relay board with a FTDI 245RL. On windows, if I change '/dev/ttyUSB0' to 2 for COM3, it works great. I tried it on a Debian machine and a CentOS 5 machine and neither worked. I ran it as root, so I don't think it is permissions. The symptom is that it seems to hang on the write(). I'm using Python 2.6. The values of serial.VERSION are: CentoS5 & Windows :2.6, Debian:1.35.
Thanks!
ser.open and ser.close only return the function object, you'd need to add "()" to actually call them, but anyway, the port is opened when instantiated.
I see nothing wrong here and would expect that it works. Only the timeout value is very small. I usually suggest values in the range of a few seconds.
Tested with current SVN head, did not notice any problem, timeout of 0.25 also works.
closing old ticket.