A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-September/049138.html below:

[Python-Dev] Running a module as a script

[Python-Dev] Running a module as a script [Python-Dev] Running a module as a scriptNick Coghlan ncoghlan at email.com
Thu Sep 30 12:11:06 CEST 2004
Patch # 1035498 attempts to implement the semantics suggested by Ilya and
Anthony and co.

"python -m module"

Means: 
- find the source file for the relevant module (using the standard locations for
module import)

- run the located script as __main__ (note that containing packages are NOT
imported first - it's as if the relevant module was executed directly from the
command line)

- as with '-c' anything before the option is an argument to the interpreter,
anything after is an argument to the script

The allowed modules are those whose associated source file meet the normal rules
for a command line script. I believe that means .py and .pyc files only (e.g.
"python -m profile" works, but "python -m hotshot" does not).

Special import hooks (such as zipimport) almost certainly won't work (since I
don't believe they work with the current command line script mechanism).

Cheers,
Nick.

-- 
Nick Coghlan
Brisbane, Australia
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4