Python Page

Here is a collection of some scripts and library modules written in Python. You may find some of these useful.

The following is list of utility scripts.

These are libraries to be used by other scripts. Put them somewhere in your PYTHONPATH.

webword

This is a command-line utility that will tell you the definition of a word. It makes use of the dictionary.com CGI script that returns the word's definition. The Python HTML parser library is used in it's most basic form.

ipinfo

This simply will tell you a given IP addresses' network and host parts. It makes use of the inet.py module described below. You supply the IP address and mask on the command line.

mailer

This is designed to be a command-line mail tool, somewhat like /bin/mail. It can be used for limited bulk-emailing (such as to a group of friends) or just for emailing some file directly from the command line. The main reason for using this versus /bin/mail is that this one does MIME encapsulation. Therefore, you can email attachments such as graphic files from the command line.

inet.py

This is the beginning of a larger set of modules that will ultimately become a network management utility (if I have time...) in the spirit of scotty/tkined. The problem with this latter package is that it's written in tcl, and I don't like many things about the tkined tool.

Right now, this module defines an IP address (IPaddr) class for storing an IP address of an interface, or something. It also has some helper functions for coverting dotted-decimal strings to and from integers.

WindowMaker.py

This defines a set of classes for making WindowMaker (an X window manager) menus dynamically. The menu works like a dictionary. You just create your menu object and assign menu items like you would a Python dictionary. You assign menu item objects to each slot, or other (nested) menus. When you print it, you have your menu printed to stdout. It's good for creating menus programmatically, and when combined with PyGreSQL can be used to build interface menu items from database records. Python is just so cool. 8-)

mailerlib.py

This contains a MimeWriter class (a bug-fixed variant of one that comes with Python), and some helper functions. It is used by the mailer program described above.

SNMP.py

This will be a general SNMP module for python. It's not done yet.