I
I
Ivan Naumov2020-06-25 23:31:21
Python
Ivan Naumov, 2020-06-25 23:31:21

How to run a Python program in the background?

I want to create a Python exe file that when opened will not open a console. Is it possible to do so? If so, how.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
ScriptKiddo, 2020-06-25
@ivan_naum

Rename your script to .pyw


Python scripts (files with the extension .py) will be executed by python.exe by default. This executable opens a terminal, which stays open even if the program uses a GUI. If you do not want this to happen, use the extension .pyw which will cause the script to be executed by pythonw.exe by default (both executables are located in the top-level of your Python installation directory). This suppresses the terminal window on startup.

https://docs.python.org/2/using/windows.html#execu...

A
Alexey Tsarapkin, 2020-06-25
@Dreamka

make the file executable and run.
PS Recently I was promoted to Admiral.

S
Saboteur, 2020-06-26
@saboteur_kiev

for example pyinstaller can generate exe files that open without a console.
Read help --noconsole

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question