[Python-checkins] python/dist/src/Doc/tut tut.tex,1.253,1.254
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Thu Oct 7 08:46:55 CEST 2004
Update of /cvsroot/python/python/dist/src/Doc/tut
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27294/Doc/tut
Modified Files:
tut.tex
Log Message:
SF patch #1035498: -m option to run a module as a script
(Contributed by Nick Coghlan.)
Index: tut.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v
retrieving revision 1.253
retrieving revision 1.254
diff -u -d -r1.253 -r1.254
--- tut.tex 28 Sep 2004 16:12:50 -0000 1.253
+++ tut.tex 7 Oct 2004 06:46:22 -0000 1.254
@@ -205,6 +205,11 @@
or other characters that are special to the shell, it is best to quote
\var{command} in its entirety with double quotes.
+Some Python modules are also useful as scripts. These can be invoked using
+\samp{\program{python} \programopt{-m} \var{module} [arg] ...}, which
+executes the source file for \var{module} as if you had spelled out its
+full name on the command line.
+
Note that there is a difference between \samp{python file} and
\samp{python <file}. In the latter case, input requests from the
program, such as calls to \function{input()} and \function{raw_input()}, are
@@ -229,9 +234,11 @@
an empty string. When the script name is given as \code{'-'} (meaning
standard input), \code{sys.argv[0]} is set to \code{'-'}. When
\programopt{-c} \var{command} is used, \code{sys.argv[0]} is set to
-\code{'-c'}. Options found after \programopt{-c} \var{command} are
-not consumed by the Python interpreter's option processing but left in
-\code{sys.argv} for the command to handle.
+\code{'-c'}. When \programopt{-m} \var{module} is used, \code{sys.argv[0]}
+is set to the full name of the located module. Options found after
+\programopt{-c} \var{command} or \programopt{-m} \var{module} are not consumed
+by the Python interpreter's option processing but left in \code{sys.argv} for
+the command or module to handle.
\subsection{Interactive Mode \label{interactive}}
More information about the Python-checkins
mailing list