Skip to content

Need help making an app working with pyinstaller #9023

Answered by bwoodsend
zapta asked this question in Help
Discussion options

You must be logged in to vote

subprocess.run(["scons", ...]) is invalid even without PyInstaller since there's no guarantee that scons is in PATH.

Ideally, you want no subprocess at all – it's Python code so you should be allowed to just import and run it – although not all packages make that easy (and this one's pretty bad).

from Scons.Script.Main import main
sys.argv[1:] = ["-f", arguments, here]
try:
    main()
except SystemExit as ex:
    if ex.code:
        raise

Or if you must use subprocesses, use sys.executable -m Scons to ensure Scons if findable without making assumptions about PATH. But in PyInstaller sys.executable is your application rather than python so you'll need to mimic python's -m option or your ap…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@zapta
Comment options

Answer selected by zapta
Comment options

You must be logged in to vote
1 reply
@rokm
Comment options

rokm Feb 12, 2025
Maintainer

Comment options

You must be logged in to vote
2 replies
@rokm
Comment options

rokm Feb 12, 2025
Maintainer

@zapta
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants