pyserial problem: script stops reading
Frederic Wenzel
fred at osuosl.org
Mon Sep 11 14:08:32 EDT 2006
On 9/9/06, Frederic Wenzel <freeed at gmail.com> wrote:
> On 9/9/06, Hendrik van Rooyen <mail at microcorp.co.za> wrote:
> > | I wrote a script on Linux that uses pyserial to read status messages
> > | from a serial line using readlines(). For now, it just displays what
> > | it gets on stdout:
> > | (...)
> > | ser = serial.Serial(port=1,
> > | baudrate=1200,
> > | rtscts=1,
> > |
> > | If the script does not time out there, I am not sure what else it is
> > | doing. It seems to be in a wait state it does not get out of.
When it stopped working again (unfortunately) I pressed ctrl c and got
the following outputÖ
14:53 | 0008 | 02 | | 5 |Rack Abs.| - | --752
14:53 | 0005 | 02 | | 2 |Rack Abs.| - | 00752
14:53 | 0008 | 02 |Traceback (most recent call last):
File "serialhandler.py", line 34, in ?
lines = sh.readLines()
File "serialhandler.py", line 29, in readLines
return self.ser.readlines()
File "/usr/lib/python2.3/site-packages/serial/serialutil.py", line
78, in readlines
line = self.readline(eol=eol)
File "/usr/lib/python2.3/site-packages/serial/serialutil.py", line
60, in readline
c = self.read(1)
File "/usr/lib/python2.3/site-packages/serial/serialposix.py", line
269, in read
ready,_,_ = select.select([self.fd],[],[], self._timeout)
KeyboardInterrupt
Apparently this is the place where it gets stuck. The select.select
line does not return, not even for a timeout.
Fred
More information about the Python-list
mailing list