Frequently I use input() sentence when testing small scripts on PythonWin. It allows a nice way to catch the script execution on the fly.
But I tried the same on GE865 and immediately after encountering the line with input() the script crashes with the following diagnostics: EOFError: EOF when reading a line
What am I doing wrong, please?
BR, Tom
Do you mean to read from SER? I don’t think stdin is redirected to SER, you can try to do this or read directly from SER.
Cosmin,
actually I don’t know 🙂 I have written just input(). In the beginning I have declared import SER import GPIO import MDM import sys import MOD,
for various functions within the script. And the script works fine, before I inserted input() into it.
Well, for a prompt and input on SER use something like this:
import SER import MOD import MDM
# presents a prompt on ASC0 then waits for input, CR terminated def ser_input(prompt, timeout): if (len(prompt) > 0): SER.send(prompt) timer = MOD.secCounter() + timeout b = SER.read() while (MOD.secCounter() < timer) and (b.find(‘r’) == -1): b = b + SER.read() if (b.find(‘r’) != -1): return b else: return ”
print ‘ser_input testrn’ SER.set_speed(‘115200’)
while (1): res = ser_input(‘Your name pleasern’, 5) if (len(res) > 0): if (res.find(‘exit’) != -1): SER.send(‘Bye bye!rn’) break SER.send(‘You said you are ‘ + res + ‘rn’)
We use cookies to enhance your browsing experience and help us improve our websites. To improve our website, we carefully select third parties that use cookies to allow us to serve specific content and achieve the purposes set out in our cookie policy. For more information on how to make adjustments through your browser to the cookies being used on your device, please click Find Out More link. By closing this banner or continuing to browse our website, you agree to our use of such cookies. FIND OUT MORE
Hi all
Frequently I use input() sentence when testing small scripts on PythonWin. It allows a nice way to catch the script execution on the fly.
But I tried the same on GE865 and immediately after encountering the line with input() the script crashes with the following diagnostics: EOFError: EOF when reading a line
What am I doing wrong, please?
BR, Tom
Do you mean to read from SER? I don’t think stdin is redirected to SER, you can try to do this or read directly from SER.
Cosmin,
actually I don’t know 🙂 I have written just input(). In the beginning I have declared import SER
import GPIO
import MDM
import sys
import MOD,
for various functions within the script. And the script works fine, before I inserted input() into it.
Well, for a prompt and input on SER use something like this: