Python and XML under 10.2(x)


I've been doing some pretty serious python work as of late and have recently had the need to parse some XML. To my delight, I looked into the /usr/lib/python2.2 directory (included with OSX) and found that the xml directory is in there... cool, I thought, they've included all of the bits and pieces.

Short form: no, they didn't. They've got everything except expat (the actual parser). All of the glue is there, but expat isn't and that's a major bummer.

So, I browsed the net to find if anyone else had this problem... sure enough, not isolated. I'm going to submit it to radar for OSX in hopes that they fix it soon.

In the mean time, I need a work-around, because waiting for Apple takes too long (it's been 2 releases since I reported the "you idiots broke my beautiful SSL over port 587 email" bug).

  1. find somebody else who had the problem. (done)
  2. download the latest expat from sourceforge
  3. untar the files in someplace appropriate (/usr/local/src is always a favorite of mine)
  4. configure
  5. make
  6. sudo make install

This puts the libraries in the /usr/local/lib location (you can edit the Makefile before the make step to change this to /usr/lib if you like, but that's not my cup of tea)

Now, you need to install pyexpat.. which, of course, requires the python source... off to python.org

Excellent info is here but you can skip the Tk/Tcl stuff if you want to, and there is no need to build frameworks if you don't want the client.