Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App run with debug mode raise OSError #3133

Closed
khs123 opened this issue Mar 29, 2019 · 3 comments
Closed

App run with debug mode raise OSError #3133

khs123 opened this issue Mar 29, 2019 · 3 comments

Comments

@khs123
Copy link

khs123 commented Mar 29, 2019

Expected Behavior

App run with debug mode raise OSError

app = make_app()
celery = make_celery(app)
KafkaProducerExt(app)
if __name__ == "__main__":
    app.run(debug=True)

Actual Behavior

App run with debug mode raise OSError, when i change debug to False, everything ok

 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
Traceback (most recent call last):
  File "app/app.py", line 8, in <module>
    app.run(debug=True)
  File "/home/khanhdv/.virtualenvs/api_jd/lib/python3.5/site-packages/flask/app.py", line 943, in run
    run_simple(host, port, self, **options)
  File "/home/khanhdv/.virtualenvs/api_jd/lib/python3.5/site-packages/werkzeug/serving.py", line 988, in run_simple
    run_with_reloader(inner, extra_files, reloader_interval, reloader_type)
  File "/home/khanhdv/.virtualenvs/api_jd/lib/python3.5/site-packages/werkzeug/_reloader.py", line 332, in run_with_reloader
    sys.exit(reloader.restart_with_reloader())
  File "/home/khanhdv/.virtualenvs/api_jd/lib/python3.5/site-packages/werkzeug/_reloader.py", line 176, in restart_with_reloader
    exit_code = subprocess.call(args, env=new_environ, close_fds=False)
  File "/usr/lib/python3.5/subprocess.py", line 557, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
OSError: [Errno 8] Exec format error

Environment

  • Python version: Python 3.5.2
  • Flask version:1.0.2
  • Werkzeug version:0.15.1
@davidism
Copy link
Member

davidism commented Mar 29, 2019

Duplicate of pallets/werkzeug#1482. You've marked a script as executable but didn't add an exec comment at the top. Either add #! /usr/bin/env python or unset the executable bit. Or use the recommended flask run command to run the development server.

@dzpt
Copy link

dzpt commented Apr 13, 2019

@davidism after adding above line, i got env: python\r: No such file or directory

@aspiringguru
Copy link

use the recommended flask run command to run the development server.
https://flask.palletsprojects.com/en/1.0.x/cli/

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants