Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#61 Code works on Win7x64 but not on Debian or CentOS 5

v1.0 (example)
closed
Chris Liechti
None
5
2014-08-04
2013-04-15
Ryan
No

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!

Discussion

  • Chris Liechti
    Chris Liechti
    2013-10-11

    • status: open --> pending
    • assigned_to: Chris Liechti
    • Group: --> v1.0 (example)
     
  • Chris Liechti
    Chris Liechti
    2013-10-11

    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.

     
  • Chris Liechti
    Chris Liechti
    2014-08-04

    • status: pending --> closed
     
  • Chris Liechti
    Chris Liechti
    2014-08-04

    closing old ticket.