Jimmy's Python Pages

This page is a collection of various Python goodies I've created. Everything here is covered by the MIT License. Please let me know if you have any questions or feedback by sending email to jimmy@retzlaff.com.

EasyDialogs for Windows 46691.0 - a lightweight port of the Macintosh EasyDialogs module
pyUnRAR 1.0 - a module that wraps the free UnRAR.dll.
X10 FireCracker Module for Python 1.0 - a module for turning electrical devices on/off
wxPython AGG Device Context Proof of Concept - using Anti-Grain Geometry in wxPython


pyUnRAR 1.0

Download - run to install

Requires: Microsoft Windows, Python 2.3 or higher, and ctypes 0.9.6. UnRAR.dll is included with pyUnRAR.

A change history is below.

pyUnRAR is a ctypes based wrapper around the free UnRAR.dll. It enables reading and unpacking of archives created with the RAR/WinRAR archivers. There is a low-level interface which is very similar to the C interface provided by UnRAR.dll. There is also a high-level interface which makes some common operations easier.

Here are some examples of the high-level interface:

import UnRAR

# extract all the files in test.rar
UnRAR.Archive('test.rar').extract()

# extract all the files in test.rar matching the wildcard *.txt
UnRAR.Archive('test.rar').extract('*.txt')

# print the name and size of each file, extracting small ones
for fileInArchive in UnRAR.Archive('test.rar').iterfiles():
    print fileInArchive.filename, fileInArchive.size
    if fileInArchive.size <= 1024:
        fileInArchive.extract()

# print the contents of any file whose name ends with test.txt
for fileInArchive in UnRAR.Archive('test.rar').iterfiles():
    if fileInArchive.filename.endswith('test.txt'):
       print fileInArchive.open('rt').read()

Change history:

Version 1.0 (12/12/2005)
- Files can now be extracted in memory using the open method of objects yielded by iterfiles.
- Files yielded by iterfiles now have a datetime property containing a time tuple.
- The logic for finding unrar.dll is now compatible with py2exe. The unrar.dll file needs to be included using the data_files option.

Version 0.1 (6/30/2003)
- Initial public release