1

I am trying to use pyinstaller to create an installer for my python program, which is typically run as follows:

python -m <folder_name>

( I can't run by calling __main.__py) Inside <folder_name> I have __main__.py, an empty __init__.py, and various folders containing python code.

I don't see any options in the pyinstaller documentation to support this type of program structure. Are there options for this?

astqx
2,1041 gold badge14 silver badges25 bronze badges
asked Jan 28, 2021 at 21:18

1 Answer 1

1

A way to tackle this could be to create another python file which is something like this

from <folder_name>.main import main
if __name__ == '__main__':
 main()

And then use pyinstaller on this file.

Also, make sure that you have an __init__.py in all the folders with python files so that they are treated like packages when performing a relative import.

Reference posts [1] [2]

answered Jan 28, 2021 at 21:49
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.