473,324 Members | 2,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

pyserial problem: script stops reading

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:

17:42 | 0005 | 02 | | 5 |Rack Abs.| - | --210
17:42 | 0008 | 02 | | 5 |Rack Abs.| - | --210
17:42 | 0001 | 02 | | 5 |Rack Abs.| - | --210
17:43 | 0008 | 02 | | 5 |Rack Abs.| - | --210
17:43 | 0001 | 02 | | 5 |Rack Abs.| - | --210
17:43 | 0005 | 02 | | 5 |Rack Abs.| - | --210
17

After a few hours, or sometimes days, of listening, the script stops
in the middle of the line and does not display any further output (as
you can see with the "17" in the last line above). That happens, even
though I set a timeout of 10s when opening the line, and on timeout it
displays the lines and reopens the port:

ser = serial.Serial(port=1,
baudrate=1200,
rtscts=1,
timeout=10)

while 1:
lines = sh.readLines()
for line in lines:
print line
ser.close()
ser.open()

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.

So even if the line received turned out to have some sort of error, I
think it should time out after a while? Maybe there is some sort of
buffer overrunning (even though the traffic is quite low: a line every
few minutes on average)?

Does anyone see any obvious error? Any hint how I can further debug the problem?

Thanks
Fred
Sep 9 '06 #1
0 1540

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: engsol | last post by:
Has anyone done a script that will rspond to the serial com port(s) receive buffer interrupt, as opposed to polling and timeouts? Win2000 is the main interest right now. Thanks Norm B
6
by: googlinggoogler | last post by:
Hiya, I've got a PIC microcontroller reading me humidity data via rs232, this is in ASCII format. I can view this data easily using hyperterminal or pyserial and convert it to its value...
20
by: luca72 | last post by:
Hello I have solve the problem of configuration with pyserial but i have another question. The serial port close every time i make the read and re-open when i do i new write. In my script...
0
by: Frederic Wenzel | last post by:
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: 17:42 | 0005 | 02 | | 5 |Rack...
15
by: Lone Wolf | last post by:
I'm trying to get data through my serial port from a CMUcam. This gizmo tracks a color and returns a packet of data. The packet has nine data points (well, really eight since the first point is...
3
by: Lone Wolf | last post by:
I want to thank everybody who tried to help me, and also to post my solution, even though I don’t think it is a very good one. Many of you correctly guessed that there was an “\r” included with...
0
by: pauland80 | last post by:
<snip> <snip> Late thanks for your both answers! (Please excuse me for that) The problem was a bug in the device firmware. But before finding this, I dugg lightly in the pyserial source...
3
by: Rainy | last post by:
Hello! I'm having some trouble with pyserial package, I'm sending commands and reading responses from a custom pcb, and sometimes I get a proper response, at other times I get nothing, and...
5
by: zxo102 | last post by:
Hello All, I have a system. An instrument attched to 'com1' is wireless connected to many sensors at different locations. The instrument can forward the "commands" (from pyserial's write()) to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.