0

Normally when you execute a python file you do python *.py

but if the whole Module which contain many .py files inside

for example MyModule contain many .py file and if I do

python -m MyModule $* what would happen as oppose python individual python file?

asked Mar 8, 2014 at 5:53

2 Answers 2

2

I think you may be confusing package with module. A python module is always a single .py file. A package is essentially a folder which contains a special module always named __init__.py, and one or more python modules. Attempting to execute the package will simply run the __init__.py module.

answered Mar 8, 2014 at 5:58
Sign up to request clarification or add additional context in comments.

Comments

1

It runs the code in the

MyModule/__init__.py

file. Print sys.argv in that file to see what the shell is giving you in terms of command line arguments. $* is meaningless in this context unless you're in a shell script (I believe)?

answered Mar 8, 2014 at 5:55

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.