Parse Mac OS X plists anywhere

This small module reads Apple’s plist XML data structure serialization format and returns a native Python data structure. In conjunction with XMLFilter, it should be compatible with all versions of Python from 1.5.2 up, on all platforms.

Notably, it works with the factory-installed copy of Python 2.2 on Mac OS X 10.2 (Jaguar).

Dependencies (all available here):

  • W3CDate for parsing dates.
  • XMLFilter (optional) for compatibility with copies of Python lacking expat or xml.sax.


import PListReader
import XMLFilter

reader = PListReader.PListReader()
XMLFilter.parseFilePath(filePath, reader,
    features = reader.getRecommendedFeatures())
result = reader.getResult()
# result could be a Python dict, list, string, number, etc.

The module uses XMLFilter if available, which provides compatibility for Python versions with only xmllib and not a real SAX parser. It falls back to xml.sax.handler instead if XMLFilter isn’t available. (The example above depends on XMLFilter. See the SAX example below for code that depends on xml.sax instead.)


Dual-licensed under the Python License and MPSL 1.1 (Mozilla License).

Download or View (6K) - the module itself. (1K) - a short test that parses a random .plist file. (1K) - a slightly longer version of the same test that doesn’t require XMLFilter.

Revision History

2004-02-14 Use native booleans if available (thanks, Dale Nagata!); minor changes to documentation
2003-09-04 Support getRecommendedFeatures() & the XMLFilter features API, and use it to disable feature_external_ges, allowing parsing to work even while disconnected from the Internet
2003-08-16 Initial version