-1

i get this error when i try to ru my flask app on glitch. I really dont know what is wrong with that line of code it says error. Help please!

Traceback (most recent call last): File "agrohelper.py", line 6, in country = input("Enter your city name : ") EOFError: EOF when reading a line

davidism
  • 121,510
  • 29
  • 395
  • 339
Josias Aurel
  • 37
  • 1
  • 7
  • Welcome Josias! Please share the rest of the agrohelper.py file, as well as more of the stack trace of the error. As of now we don't know what that line of code is doing without seeing more. – Jon Feb 05 '20 at 15:45
  • this is link to github repo : https://github.com/JosiasAurel/AgroHelper/blob/master/agrohelper.py – Josias Aurel Feb 05 '20 at 15:54
  • this is the error i get on glitch : Traceback (most recent call last): File "server.py", line 6, in country = input("Enter your city name : ") EOFError: EOF when reading a line – Josias Aurel Feb 05 '20 at 15:55
  • how are you running the program? `input()` is used for terminal input, but this appears to be a web server you are running indirectly from `server.py`. – Jon Feb 05 '20 at 16:20

1 Answers1

0

The issue is probably that when you start the flask server, which will call your agrohelper.py file, and the server startup method doesn't expect the input() function to stop and hang, waiting for the user to input a value. The result is that the input() function immediately returns without any input or bytes read. See https://docs.python.org/2/library/exceptions.html#exceptions.EOFError

If you want to build an app that has user input you may want to look at a forms plugin like Flask-WTF: https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-iii-web-forms

If you are wanting to build a test script to pick a country, try reading a static data file such as the data.json you already have.

Jon
  • 1,820
  • 2
  • 19
  • 43