Home > Mobile >  black console using py-to-exe
black console using py-to-exe

Time:09-26

i tried to make an executable file from my main_app.py using pyinstaller. All works but when im duble click the .exe files generated its popping out just a black console, not the app..

This is the command i used:

pyinstaller --onefile -w main_app.py

Also i used and auto-py-to-exe all variants, and i have the same problem, nothing displayed on the .exe after double click, just the black console

This is how my project looks: directory files

I have the main_app.py file that calls the others scripts from different subdirectories:

from gitscripts.main_git import gitmainfunction
from svnscripts.main import svnmainfunction
from jirascripts.jira_main import jiramainfunction
from confluencescripts.confluence_main import confluencemainfunction
print("\nWelcome to `Easy Datas`!\n")
print("Before trying to use the app be sure that you are connected to URA and ADN 2.0 !!\n")
print("Below are the current type of datas that can be processed: ")
print(" SVN (s)\n GIT (g)\n BUGZILLA (b) \n JIRA (j) \n Confluence(c)")


def main_app():
    subject = input("\nChoose for what datas do you want to make the final raport (s/g/b/j/c):")
    match subject:
        case "s":
            svnmainfunction()
        case "g":
            gitmainfunction()
        case "b":
            bugzillamainfunction()
        case "j":
            jiramainfunction()

        case "c":
            confluencemainfunction()
if __name__ == '__main__':
    main_app()```

This is how the program looks using the IDE compiller vs .exe file: enter image description here

He should display what is in the left corner, but isnt it . In the main_app.py i just called all the function/scripts from those subdirectories. If someone can help me solving this or if you know other way to make main_app.py to .exe

Ty!

CodePudding user response:

You can use auto-py-to-exe for this, type auto-py-to-exe instead of pyinstaller --onefile -w main_app.py as this does not always work.

CodePudding user response:

You have to include your external scripts in the build-process, as the subdirs with the scripts are not automatically available to your *.exe.

Please refer to the dokumentation: https://pyinstaller.org/en/stable/spec-files.html#adding-files-to-the-bundle

This is also detailed in this post (just an example, there are a lot more): Pyinstaller not picking up Tree or Data files

  • Related