Next / Previous / Contents / TCC Help System / NM Tech homepage

8. Code prologue

This section begins the exposition of the actual code, in lightweight literate programming style.

catweb
#!/usr/local/bin/python
#================================================================
# catweb:  Build index to bird photos.  For documentation see:
#   http://www.nmt.edu/~john/scans/slides/catweb/
#----------------------------------------------------------------

8.1. Module imports

Because this application uses generators, the first import must be the one that enables generators in older versions of Python.

catweb
#================================================================
# Imports
#----------------------------------------------------------------

from __future__ import generators

The sys module is used for retrieving command line arguments. We also need the os module for manipulating path names.

catweb
import sys, os

The txny module is from A system for representing bird taxonomy.

catweb
import txny as txnyModule

We'll also need the abbr.py module, which contains the BirdId class.

catweb
import abbr as abbrModule

The birdimages module is described in An XML-based bird cataloging system. It represents cataloged images.

catweb
import birdimages

The archindex module is described in archx: A program to index a photo archive.

catweb
from archindex import *

The xml4create module is documented in Python and the XML Document Object Model (DOM) with 4Suite.

catweb
import xml4create as xc