Below is simple test code named app.py
from flask import Flask
import webview
app = Flask(__name__)
@app.route('/')
def hello_world():
#print('test') # <- note here
return 'Hello World!'
if __name__ == '__main__':
window = webview.create_window(title='app',url=app)
webview.start()
Build it into exe by following command line
pyinstaller -F -w --noupx app.py
under dist folder there is a app.exe
, it runs flawlessly.
But if I uncomment the print line, recomplie, it says "ERR_EMPTY_RESPONSE".
Why?
Additional info:
- I also tested logging, as long as there is something printed to console, it crashes.
- If compiled without
-F
flag, exe runs with a ugly black console, printing won't make it crash.