0

I recently created a Python program and I managed to pack it into an exe by using PyInstaller.

The problem is the exe it produced generates a window that disappears so fast I cant read whats in it.

I have found no way to keep that window open:

-c and -w PyIinstaller commands are not working, neither is --debug all: the window is still appearing, producing super-fast terminal text in it and then closing itself without giving me enough time to read what problem it encountered.

Is there a way I can make PyInstaller exes produce a logfile of what happens when I run them? Do you have any other suggestion on what can I do to understand why my program crashes, or to keep its window opened up so I can read what is in it? Thanks for your interest :)

1 Answers1

0

Troubleshooting your code is nothing to do with Pyinstaller. You can use python logging and redirect the console output to a text file. There is a good example in here.

Also, according to this, if you have problem with importing your modules and needs more info you can use verbose mode, -v flag to print more info about the state of importing modules by Pyinstaller.

You can also pass a -v (verbose imports) flag to the embedded Python interpreter (see Giving Run-time Python Options above). This can be extremely useful. It can be informative even with apps that are apparently working, to make sure that they are getting all imports from the bundle, and not leaking out to the local installed Python.

For your last question if you need to use a JSON string you can use a dictionary type with Python then use json module (json.dumps) to convert your dict to a valid JSON string. You can find more info in here.

Masoud Rahimi
  • 5,785
  • 15
  • 39
  • 67