Next / Previous / Contents / Shipman's homepage

4. Module imports

This module is built on top of a sizeable collection of other modules. Here are their imports.

birdnotes.py
# - - - - -   I m p o r t s

We'll need the standard Python sys module for access to standard I/O streams. We also need os and stat to retrieve file timestamps, datetime for calendar functions, and the standard regular expression library re.

birdnotes.py
import sys
import os
import stat
import datetime
import re

XML processing is done using the lxml.etree package. We call this module et here.

birdnotes.py
from lxml import etree as et

Because the module manipulates GPS waypoints, we next import a part of the author's mapping package, terrapos.py. See the documentation, A Python mapping package.

birdnotes.py
import terrapos

The next module is a vital part of the bird records system: the taxonomy module. See the documentation: A system for representing bird taxonomy. Module txny.py is the main taxonomy module. Module abbr.py contains auxiliary functions for handling general bird identifications including species pairs and hybrids.

birdnotes.py
import xnomo3
import abbr as abbrModule

Rather than use string constants for the names of the XML elements and attributes in the birdnotes.rnc schema, we use a script named pyrang to extract those names and write a file named rnc.py containing declarations of symbolic names for each one. For more information, see the documentation for pyrang. See also the generated actual rnc.py file.

birdnotes.py
import rnc