pallets / werkzeug

The comprehensive WSGI web application library.
https://werkzeug.palletsprojects.com
BSD 3-Clause "New" or "Revised" License
6.63k stars 1.73k forks source link

`termios` error when running Flask application through `myapp` executable #2933

Closed matt-sd-watson closed 1 month ago

matt-sd-watson commented 1 month ago

I have created a python package executable through myapp as described here. The application entry point is a Flask app with the default port 5000. When running the executable as follows, the program appears to be able to detect the default port to be used. However, it gives a termios error and no application is served to the default localhost address at http://127.0.0.1:5000/my_app/

./my_app

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/matt/.local/share/pyapp/my_app/14656550572188801628/0.18.0/lib/python3.12/site-packages/my_app/wsgi.py", line 108, in main
    app.run(host=HOST, debug=args.is_dev_mode, threaded=args.threading, port=args.port)
  File "/home/matt/.local/share/pyapp/my_app/14656550572188801628/0.18.0/lib/python3.12/site-packages/flask/app.py", line 889, in run
    run_simple(t.cast(str, host), port, self, **options)
  File "/home/matt/.local/share/pyapp/my_app/14656550572188801628/0.18.0/lib/python3.12/site-packages/werkzeug/serving.py", line 1106, in run_simple
    run_with_reloader(
  File "/home/matt/.local/share/pyapp/my_app/14656550572188801628/0.18.0/lib/python3.12/site-packages/werkzeug/_reloader.py", line 448, in run_with_reloader
    ensure_echo_on()
  File "/home/matt/.local/share/pyapp/my_app/14656550572188801628/0.18.0/lib/python3.12/site-packages/werkzeug/_reloader.py", line 428, in ensure_echo_on
    termios.tcsetattr(sys.stdin, termios.TCSANOW, attributes)
termios.error: (5, 'Input/output error')

Environment:

matt-sd-watson commented 1 month ago

Resolved by using a waitress server with serve as opposed to a dev WSGI server.