The listmodules CGI Script

Fredrik Lundh | October 2006 | Originally posted to

Hidden in the documentation source directory in 2.5 is a small script that lists all available modules for a Python installation:

$ python Doc/tools/
# module list (generated by
# timestamp='20061009T060000Z'
# sys.version='2.2.3'
# sys.platform='sunos5'

I recently found myself doing some work on a web server with an old and somewhat incomplete Python installation, and no shell access, so I ended up adding a CGI interface to the script. Here’s the code:


and here’s how to use it:

  1. Download the script to your machine.
  2. Edit the script’s “#!” line so it points to the Python interpreter on your server.
  3. Upload the script to the server, and put it somewhere where you can install Python CGI scripts. Make sure it’s executable.
  4. Point to the corresponding URL from a web browser.

If everything went well, the script will print a list of all available standard modules, sorted in lexical order.

To get a list of all modules, remove the block that follows the “get rid of site packages” comment.

(Note that this script should only be used temporarily, and for your own personal use. Your ISP probably won’t appreciate if you publish a link to a live instance of this CGI script.)


A Django site. rendered by a django application. hosted by webfaction.