0

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!

Champs
  • 121
  • 7

3 Answers3

0

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.

  • i tried also and auto-py-to-exe, and same, nothing displayed on the console – Champs Sep 26 '22 at 10:50
  • Give me a min and I will find a way to solve it for you. And if you have this in github share the link, I might get a solution to it then. –  Sep 26 '22 at 10:53
  • OK will find out what's wrong –  Sep 26 '22 at 10:55
  • It's a problem in your side from my end it work perfectly. And there is no solution to that. So sorry I can not help you @Champs –  Sep 26 '22 at 11:38
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 30 '22 at 09:35
0

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

flipSTAR
  • 579
  • 1
  • 4
  • 18
  • yes, i did that but not working – Champs Sep 26 '22 at 11:00
  • You said you did that but in your command to create the *.exe ```pyinstaller --onefile -w main_app.py``` it is not included to copy the subdirs+data. Please check that again. – flipSTAR Sep 26 '22 at 11:03
  • with the command yes, after i did wih ```auto-py-to-exe``` and i included and all the subdirectories – Champs Sep 26 '22 at 11:04
  • ok, lets step back and try two things: 1) execute your *.exe in an already open command prompt, so you can see the error message 2) try a --onedir build – flipSTAR Sep 26 '22 at 11:10
  • known that i have multiple directories now, what command should i use? – Champs Sep 26 '22 at 11:19
  • the *exe to start is in your distribution folder. This distribution folder now represents what is extracted to a temp folder when using a onefile build. Search for the *.exe inside and run it. If auto-py-to-exe (or your build-command) was configured correctly and works like expected there should also be copies of your subfolders "bugzilla,..etc" inside the distribution-folder. Does this work? Do you understand what I mean? – flipSTAR Sep 26 '22 at 12:30
  • no, i dont undestand, like idk why not working cause i have no errors – Champs Sep 26 '22 at 15:41
  • Have you tried a onedir-build and included your subfolder structure like described in the documentation? – flipSTAR Sep 26 '22 at 17:41
0

Looks like the answer from @ezpie shows that the issue is from your end. I'd suggest reinstalling pyinstaller. First uninstall pyinstaller: pip uninstall pyinstaller. Next Use the following commands seperatly to make sure your pip is fully updated:

python -m pip install --upgrade pip
pip install --no-use-wheel --upgrade distribute
pip install --upgrade setuptools

if --no-use-wheel doesn't work use --no-binary :all:

After this reinstall pyinstaller pip install pyinstaller

Now make sure you are running the exe in your dist folder and not your build folder. Finally, if this is difficult, reinstall auto-py-to-exe, and use that. If the problem still persists then I can't really help you furthur as it sounds like it is potentially an issue with your system. Hope this helps :)

Thomas
  • 1,214
  • 4
  • 18
  • 45