Reputation: 385
I have created a basic hello world application in flask. Then I did
pyinstaller --noconsole main.py
. I have got main.exe file in /dist directory.
When I tried to run it, I am getting an alert of error showing Failed to execute script main
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run(debug=False)
Upvotes: 1
Views: 1348
Reputation: 21
Redirect stdout, either no nothing sys.stdout = sys.stderr = open(os.devnull, 'w')
or to file sys.stdout = open('file', 'w')
if you still want to be able to view its output at some stage
You can add the desired function to the top of your flask script
Upvotes: 2