input() run on the GE865

4 thoughts on “input() run on the GE865

  1. 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

    1. 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.



      1. 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.

        1. 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):
              timer = MOD.secCounter() + timeout
              b =
              while (MOD.secCounter() < timer) and (b.find(‘r’) == -1):
                  b = b +
              if (b.find(‘r’) != -1):
                  return b
                  return ”

          print ‘ser_input testrn’

          while (1):
              res = ser_input(‘Your name pleasern’, 5)
              if (len(res) > 0):
                  if (res.find(‘exit’) != -1):
                      SER.send(‘Bye bye!rn’)
                  SER.send(‘You said you are ‘ + res + ‘rn’)