< BACKMake Note | BookmarkCONTINUE >
152015024128143245168232148039196038240039088173205162105045222218065012137085045216133

Python Scripts

The Python distribution comes with lots of scripts that you can study and use. Those scripts are stored in two directories: \Tools and \Demos.

Table 17.1 lists programs that are stored in the \ Tools directory.

Table 17.1. Programs Stored in the Tools Directory
Program Description
bgen Generates complete extension modules from a description (under development).
faqwiz FAQ Wizard.
freeze Creates a standalone executable from a Python program.
modulator Interactively generates a boiler plate for an extension module. Works easiest if you have Tk.
Pynche The PYthonically Natural Color and Hue Editor.
versioncheck Checks whether you have the latest version of a specific package.
webchecker Checks Web sites for bad links.

The \Tools\Scripts subdirectory contains a number of useful single-file programs. They are shown in Table 17.2.

Table 17.2. Programs Stored in the Tools\ Scripts Directory
Program Description
byteyears Prints the product of a file's size and age
checkpyc Checks presence and validity of .pyc files
classfix Converts old class syntax to new
copytime Copies one file's atime and mtime to another
crlf Changes CRLF line endings to LF (Windows to UNIX)
cvsfiles Prints a list of files that are under CVS
dutree Formats du output as a tree sorted by size
eptags Creates Emacs TAGS file for Python modules
findlinksto Recursively finds symbolic links to a given path prefix
fixcid Massive identifier substitution on C source files
fixheader Adds some cpp magic to a C include file
fixnotice Fixes the copyright notice in source files
fixps Fixes Python scripts'first line (if #!)
ftpmirror FTP mirror script
h2py Translates #defines into Python assignments
ifdef Removes #if(n)def groups from C sources
lfcr Changes LF line endings to CRLF (UNIX to Windows)
linktree Makes a copy of a tree with links to original files
lll Finds and lists symbolic links in current directory
logmerge Consolidates CVS/RCS logs read from stdin
mailerdaemon Parses error messages from mailer daemons
methfix Fixes old method syntax def f(self, (a1, ..., aN)):
mkreal Turns a symbolic link into a real file or directory
ndiff Intelligent diff between text files
nm2def Creates a template for PC/python_nt.def
objgraph Prints object graph from nm output on a library
pathfix Changes #!/usr/local/bin/python into something else
pdeps Prints dependencies between Python modules
pindent Indents Python code, giving block-closing comments
ptags Creates vi tags file for Python modules
rgrep Reverses grep through a file
suff Sorts a list of files by suffix
sum5 Prints md5 checksums of files
tabnanny Checks inconsistent mixing of tabs and spaces
tabpolice Checks for ambiguous indentation
texi2html Converts GNU texinfo files into HTML
treesync Synchronizes source trees
untabify Replaces tabs with spaces in argument files
which Finds a program in $PATH
xxci Wrapper for rcsdiff and ci

The \ Demo directory contains good examples of how to write Python code. The programs are described in Table 17.3.

Table 17.3. Programs Stored in the Demo Directory
Program Description
classes Some examples of how to use classes.
dns Module that implements a DNS client.
embed Example of embedding Python in another application (see also pysvr).
extend Example of using the generic Makefile.pre.in from the Misc directory to build a statically linked or shared extension module.
ibrowse Emacs info file browser (uses stdwin).
md5test Test program for the optional md5 module.
metaclasses Metaclasses examples.
pdist Filesystem, RCS, and CVS client and server classes. This directory contains various modules and classes that support remote file system operations.
pysvr Example of embedding Python in a threaded application.
rp Set of classes for building clients and servers for Sun RPC.
sockets Examples for the new built-in module socket.
sgi Demos that only run on Silicon Graphics machines.
stdwin Demos that use the STDWIN library.
threads Demos that use the thread module (for SGIs).
tkinter Demos using the Tk interface.
zlib zlib demo.

The directory /Demos/scripts contains a collection of useful executable Python scripts. They are presented in Table 17.4.

Table 17.4. Programs Stored in the Demos/Scripts Directory
Script Description
fact Factorizes numbers
from Summarizes mailbox
ftpstats Summarizes ftp daemon log file
lpwatch Watches BSD line printer queues
markov Markov chain simulation of words or characters
mboxconvvert Converts MH or MMDF mailboxes to UNIX mailbox format
morse Produces Morse code (audible or on AIFF file)
mpzpi test mpz—prints digits of pi (compare pi.py)
pi Prints all digits of pi—given enough time and memory
pp Emulates some Perl command line options
primes Prints prime numbers
script Equivalent to BSD script
unbirthday Prints unbirthday count
update Updates a bunch of files according to a script


Last updated on 1/30/2002
Python Developer's Handbook, © 2002 Sams Publishing

< BACKMake Note | BookmarkCONTINUE >

Index terms contained in this section

\Demos directory
      scripts stored in 2nd 3rd 4th
\Tools directory
      scripts stored in 2nd 3rd 4th
applications
      stored in \Tools and \Demos directories 2nd 3rd 4th
bgen program
byteyears program
checkpyc program
classes program
classfix program
copytime program
crlf program
cvsfiles program
directories
     \Tools and \Demos
            scripts stored in 2nd 3rd 4th
dns program
dutree program
embed program
eptags program
extend program
fact script
faqwiz program
findlinksto program
fixcid program
fixheader program
fixnotice program
fixps program
freeze program
from script
ftpmirror program
ftpstats script
h2py program
ibrowse program
ifdef program
lfcr program
linktree program
lll program
logmerge program
lpwatch script
mailerdaemon program
markov script
mboxconvvert script
md5test program
metaclasses program
methfix program
mkreal program
modulator program
morse script
mpzpi script
ndiff program
nm2def program
objgraph program
pathfix program
pdeps program
pdist program
pi script
pindent program
pp script
primes script
programs
      stored in \Tools and \Demos directories 2nd 3rd 4th
ptags program
Pynche program
pysvr program
rerep program
rpc proogram
script script
scripts
      \Tools and \Demos directories 2nd 3rd 4th
sgi program
sockets program
software
      stored in \Tools and \Demos directories 2nd 3rd 4th
stdwin program
suff program
sum5 program
tabnanny program
tabpolice program
texi2html program
threads program
tkinter program
treesync program
unbirthday script
untabify program
update script
versioncheck program
webchecker program
which program
xxci program
zlib program

© 2002, O'Reilly & Associates, Inc.