D
D
Dmitry2018-06-26 09:28:52
Python
Dmitry, 2018-06-26 09:28:52

How did a browser window automatically open when running *.exe ( pyinstaller + flask)?

the bottom line is that at startup, a console opens with an ip address, but I want the browser window to open right away, can this be done somehow?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2018-06-27
@ipatov_dn

first edition:
pyinstaller --onefile --add-data ".;." -r "BDays.txt" app.py
second revision: solved by adding

import webbrowser
webbrowser.open('https://docs.python.org')

W
wh1t3fox, 2018-06-27
@wh1t3fox

main-qimg-9c11f66e2ac2717b454a4e9cec2fdc
run on console C:\python27\python -m pip install pyinstaller
then this C:\python27\scripts\pyinstaller --onefile flask_exe.py
which will create an executable (which won't work) but more importantly it will create a file flask_exe.spec which tells pyinstaller how to create an executable
we need to tell pyinstaller how to create stuff it doesn't understand by doing the following 3 changes in our spec file
after making these changes restart pyinstaller c:\python27\scripts\pyinstaller flask_exe .spec
this will create a new dist folder with flask_exe.exe included, then run flask_exe.exe

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question