-3

I already create executable file from my .py script. Everything work correctly. I was just wondering if it is possible to open this exe without open cmd window? While using the application, messages appear in cmd that are unnecessary for the common user of the application. Application has been created with tkinter. Thank you in advance :)

Avellith
  • 3
  • 1
  • Or this ? [Getting rid of console output when freezing Python programs using Pyinstaller](https://stackoverflow.com/questions/17584698/getting-rid-of-console-output-when-freezing-python-programs-using-pyinstaller) – BcK Dec 17 '20 at 13:47
  • @MauriceMeyer Both of this, will work only when i open .py from cmd or it wil close application with cmd. Tell me if i am wrong with this summary. In my case appliction need to work after opening it from .exe but without cmd. Is there any option? – Avellith Dec 17 '20 at 13:59
  • @BcK I think it wont work too. I explain it above. Let me know if i misunderstand something. – Avellith Dec 17 '20 at 14:00
  • @Avellith: If you double click the exe built using `windowed/noconsole` flags no CMD window *should* be shown. In case you are using subprocess within your script this is something different. For any other cases, please make your question clearer. – Maurice Meyer Dec 17 '20 at 14:31

1 Answers1

0

You didn't specify the tools used to create the executable.

Assuming that you used PyInstaller:

When you execute the command pyinstaller [filename].py, PyInstaller will actually create 2 folders and one .spec file in your working directory:

  • A dist folder, containing the bundled app.
  • A build folder, containing some log files and working files.
  • A [scriptname].spec file, containing the specifications given to PyInstaller during the creation of the executable file.

In your case (assuming that PyInstaller was used), to stop the terminal from opening on startup, you have to:

  1. Open the .spec file
  2. Edit the entry console=True, setting it to false will prevent the terminal from opening.
  3. Execute again the pyinstaller command in cmd, this time targeting the [scriptname].spec file.
Markintosh
  • 44
  • 7