pyserial problem: script stops reading
Steve Holden
steve at holdenweb.com
Mon Sep 11 15:18:13 EDT 2006
Frederic Wenzel wrote:
> 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
Try running your program with
python -i [programname.py]
That way after you ^C it you'll be able to poke around a bit in an
interactive shell (though I suspect that the stackframe contents will
have been lost, so you'll only have globals to look at - that may or may
not be enough).
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden
More information about the Python-list
mailing list