Originally I wrote PyZ3950 to support Tyrannioware, my home book cataloging program. The Cheshire Project at the University of Liverpool adopted it, and I would like to acknowledge their financial support and Rob Sanderson's contributions as co-developer. The ASN.1 and Z39.50 modules are distributed together partly for my convenience, and partly because the Z39.50 code may serve as an illustration of the ASN.1 API. (I wrote my own ASN.1 code because I wanted its client to be able to use normal Python data types, and use ASN.1 specifications run through the included compiler: neither PySNMP nor Pisces offer this.) The only other Python Z39.50 implementation I know of is part of a larger commercial product, wxPresso.

There's also a MARC module in zmarc.py (handles parsing only), and a graphical Zthes browser as an example.

The software requires Python 2.2 or later, and is licensed under the X licence (details in the files themselves), but the zoom interface requires Dave Beazley's PLY package, licensed under the LGPL. Click here to download version 2.04 of PyZ3950. It's packaged with distutils, so unzip and untar, and then python setup.py install. Most development has been done under Linux, but I've tested briefly under Win98 (and, in theory, the code should run anywhere Python runs). The CVS repository is at sourceforge.


Link to pydoc documentation for zoom implementation (recommended interface).


PyZ3950 currently is capable of sending and receiving v2 or v3 PDUs Initialize, Search, Present, Scan, Sort, Close, and Delete. For client work, you probably want to use ZOOM, which should be in the same distribution as this file, in zoom.py. The Server class in this file implements a server, but could use some work. Both interoperate with the Yaz toolkit and the client interoperates with a variety of libraries.

Useful resources:


asn1 is a relatively general-purpose ASN.1 BER encoder and decoder. Encoding and decoding functions (asn1.encode and asn1.decode) take an ASN.1 spec, and transform back and forth between a byte stream and what I consider a natural Python representation of the data.

Separating the ASN.1 specification from the code would allow compilation of the specification to inline Python or C code, or to a specification for a C-based engine.

This module supports the following ASN.1 types: