read 9 bytes

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Jun 11 00:17:09 EDT 2007


En Mon, 11 Jun 2007 00:52:28 -0300, nik <nikbaer at gmail.com> escribió:

> I need to read a 9 byte response from a device on the serial port.
>> From reading the pySerial documentation it appears that I can only
> read in characters at a time.
>
> If I do: serialport.read(4)
> I would get 8 bytes,

Why do you think so? read(4) will read up to 4 bytes, or less if the  
specified timeout elapses.

> Is there a trick to read 9 bytes off of a serial port?

read(9) (don't forget to set the timeout)

-- 
Gabriel Genellina




More information about the Python-list mailing list