Voidspace

Movable Python: The Portable Python Distribution

The Special Files

Controlling and Customising Movable Python

Python on a Stick

Introduction

Some of the behavior of Movable Python is controlled by a few files in the lib directory.

You can configure :

  1. The environment programs run in - customize.py
  2. Paths to add to sys.path - syspaths.pth
  3. Default options programs are run with - config.txt
  4. The directory that the File Chooser dialog opens in - initial_directory.txt
  5. The programs lauched by the Quick Launch buttons - quicklaunch.txt
  6. Your IPython config options - ipythonrc.ini

These files all use simple text based formats; they can be edited with any text editor.

Some of these can be changed by the GUI, and are probably better not edited by hand. See the individual sections for details.

Note

The GUI can only save changes if it has write permission in the lib directory.

That means you can't save changes if your distribution is on a CD.

customize.py

This Python script is run (run, not imported) before every program is run. This means you can edit it to customise the environment your scripts run in.

It is also run before entering interactive mode. (- at the command line, or the interpreter launched from the GUI.)

There is a variable called interactive available to you. This is set to True if Movpy is entering an interactive session. You can use this to conditionally do different things when running a script and when using the interactive interpreter.

Note

Note the spelling of the filename customize.py.

Sorry for the inconsistentency in my spelling. Surprised

syspaths.pth

This file lets you specify directories to add to the module search path (sys.path).

If paths are specified as relative locations, they should be relative to the 'lib/' directory in which the path file lives.

If you manually add a module into your lib directory that normally has a '.pth' file [1], then you will need to make an entry here.

This includes modules like 'wx', 'pyGTK', 'PIL', etc. (Note that win32 has particular complications. Read the instructions at win32ext).

Copying the contents of the '.pth' file into syspaths.pth will usually be sufficient.

Note

Technically .pth files can contain import statements. This isn't supported by Movable Python, and I've never seen it in the wild.

config.txt

This file lets you specify some of the command line options as being always on. This lets you easily make movpy always use psyco, or always drop into interactive mode after running scripts. Each option should be on its own line.

For example :

-p
-i

See the Command Line page for details of what the options do.

Running Movable Python with the -o command line option means that config.txt isn't used.

config.txt can be edited by hand, but it is also changed by the GUI.

initial_directory.txt

This file stores the directory that the File Chooser dialog opens in. It is changed every time you open a file. Next time you use the dialog it will start in the same directory.

initial_directory.txt can be edited by hand, but it is also changed by the GUI.

quicklaunch.txt

This file saves the settings of your Quick Launch buttons.

quicklaunch.txt is not designed to be edited by hand [2].

ipythonrc.ini

This file is your configuration file for IPython. IPython is very powerful and flexible. See the manual in the 'manuals' directory for details on how to configure and use IPython to its best.


Footnotes

[1].pth files normally live in the site-packages folder, so it should be easy to see if a package has a .pth file.
[2]If you mess it up you will lose your settings. You have been warned. Cool

Return to Top
Part of the Movable Python Docs
Page last modified Wed Jul 05 22:57:22 2006.

Buy it Now

Powered by Python

Site Built with rest2web


Site Built with rest2web

Python on Voidspace