Quantcast
Viewing all articles
Browse latest Browse all 1268

Python • EOFError from input( )

Howdy Folks:

I have a (reduced) code snippet here to keep polling user input from a process:

Code:

import serialport = serial.Serial( INSERT_PORT_HERE, baudrate=19200, timeout=0 )while True :    try :        x = input( )        port.write( x )    except KeyboardInterrupt :        break
Whenever I run it it gives me the following error:

Code:

  File "/home/maximet/sandbox/serial/term.py", line 15, in port_send    x = input( )EOFError: EOF when reading a line
I could have an error handler for the EOF error, but the loop will just keep calling the handler instead and I don't get any input.

I really don't know what I have done incorrectly here?

Thanks in advance, Gerry.

Statistics: Posted by gerrypkan — Sun Mar 17, 2024 1:46 pm



Viewing all articles
Browse latest Browse all 1268

Trending Articles