Command Line OptionsMovable Python Configuration Options![]() Introduction![]() Movable Python has lots of command line options. Most of these can be configured through the GUI. Several of the command line options are the same as (or mimic) the Python command line options. This page documents the different options, and ends with a discussion of some of the Python command line options that aren't supported by Movable Python. First the SummaryIf you type movpy -h at the command line, you get the following help message :
usage: movpy [option] ... [-c cmd | file | -] [arg] ...
Options and arguments :
-c cmd : program passed in as string (terminates option list)
-f : Change working directory to the script directory
-h : print this help message and exit
-i : inspect interactively after running script,
uses InteractiveConsole or IPython - probably needs a real stdin
-m mod : run library module as a script (terminates option list)
-u : unbuffered stdout and stderr
-V : print the movpy version and Python version number and exit
-x : skip first line of source, allowing use of non-Unix forms of #!cmd
-IPOFF : Don't use IPython, even if it is available, default to InteractiveConsole
-p : Attempt pysco.full() (incompatible with IPython interactive shell)
-b : Pause for <enter> after terminating script
-o : override saved options, only use comand line options
-koff : A command line option for the GUI, force no console
-k : A command line option for the GUI, force a console
-la file : Log output to file, open append in write mode
-lw file : Log output to file, open logfile in write mode
file : program read from script file
- : drop straight into InteractiveConsole or IPython
-pylab : Launch IPython in pylab mode
--config dir : Directory for config files (~ will be expanded)
arg ...: arguments passed to program in sys.argv[1:]
Run movpy without a file argument to bring up a lightweight GUI to choose a script
('-c', '-', '-V' or '-h' options override this behaviour)
Python environment variables are ignored.
As you can see, this rather terse text documents all the command line options.
If you need more of an explanation, read the rest of this page... Python-Like OptionsSome of the command line options are the same as the normal Python command line options. (Type python -h at the command line to see what I mean.) This means that programs which call sys.executable, followed by come command line options will still usually work. IDLE does this for example. The following options are intended to have the same effect (more-or-less) as when used with normal Python.
For a discussion of Python command line options that are unsupported see Unsupported Python Command Line Options. The OptionsThis section lists all of the Movable Python command line options and
explains what they do. They are basically all accesible through the
GUI, but you will still need to know what they do. If you use these options at the command line, the letters must be prefixed with a -. For example : movpy -p -f -i filename This runs the Python programme filename, in its directory, with psyco on, and switches to interactive mode after running. cThis option allows you to pass a small program as a string. It is executed and then Movable Python terminates. IDLE uses this option to launch its subprocess. fRun the program in its directory. A lot of scripts expect the current directory to be the directory in which they are located. hPrints the help message. iEnter the interactive interpreter mode after running the program. This allows you to inspect the objects used by the program. If IPOFF and p are both off, then the interpreter used will be IPython. The b option is ignored if i is set. A console box is always used if you specify i. mRun a module as a script. The module must be somewhere on sys.path. uRun with unbuffered stdout and stderr. This is simulated on the Python level, and so doesn't apply to the underlying C stdout and stderr. VPrint the version of Movable Python and the version of Python. xSkip the first line of the script. pSwitch psyco the specializing compiler on. (Do a psyco.full()). This accelerates most Python programs. It is not compatible with IPython, so using p with i will switch IPython off. bPause for <enter> after running the script. This is useful if the script is a command line script that terminates immediately after running. Selecting b allows you to see the results before the console window vanishes. oOverride config.txt. You can save default options in the Special File config.txt. (Also through the GUI.) o allows you to run a program without using the default options. dieIf the GUI is launched with the die option, it will exit immediately it runs a program. koffIf koff is selected, then movpy.exe will not launch programs with a console box. kIf k is selected, then movpyw.exe will launch programs with a console box. -- forces Movable Python straight into interactive interpreter mode. Whether IPython is used depends on the IPOFF option. All Movpy command line options other than IPOFF (and o) are ignored when going straight into interactive interpreter mode. (And a console box is forced even if you didn't specify one !) Additional command line options after the - are passed to IPython. Note The option pylab is special cased, see below. Additionally, the option libdir is set by Movable Python, other than that you can customize the behaviour of IPython by passing in command line arguments. - pylabMovable Python has built in support for matplotlib. If you have the matplotlib files in your lib/ directory you can run the following at the command line : movpy.exe - -pylab This should drop you straight into a IPython session, with pylab enabled. Because of a limitation in IPython, the pylab session will run in its own namespace. This means that although customize.py will run, you won't have access to the namespace it ran in. You can still import movpy of course. configThe config option allows you to specify a directory for config files. ~ will be expanded to the users home directory : movpy --config ~/movpy
Unsupported Python Command Line OptionsMovable Python supports most of the Python Command Line Options. There are still a few it doesn't support. Some of the currently unsupported ones it would be possible to implement, and others it would be very hard. If Movable Python is launched with an unsupported command line option, then a warning is printed to sys.stderr, and the option is ignored. Currently unsupported ones are :
If you have a particular need for any of these options to be implemented, then
make a case for it on the Mailing List.
It may be possible. Environment VariablesPython allows its behaviour to be affected by several environment variables. In order to isolate Movable Python [1] from the current Python install (which may be a different version of Python), these environment variables aren't accessible. It would be possible to create an alternative set of environment variables specific to Movable Python. As Movable Python is designed to be a portable distribution, it doesn't seem worthwhile. (In other words, no-one would use them.) The environment variables supported by a normal Python installation are :
Has the same effect as the -v command line option.
Has the same effect as the -i command line option.
Has the same effect as the -d command line option.
';'-separated list of directories prefixed to the default module search path. The result is sys.path.
Alternate <prefix> directory (or <prefix>;<exec_prefix>). The default module search path uses <prefix>lib.
Ignore case in 'import' statements (Windows). It would be possible to implement options or environment variables to support some of these, if there was a particular need. Again, make your case on the Mailing List. Return to Top |
|