Comment 6 for bug 389358

Revision history for this message
Zooko Wilcox-O'Hearn (zooko) wrote :

Here's another reason to use setuptools: then you can use pkg_resources to find and read in a string at runtime. This is a better way to get the XML spec than passing a filename to xmlutil.parse(), because it can be hard to figure out what the filename should be at runtime, especially if you might be deployed inside a zip file, inside a py2exe app, etc.

I'm working on a patch that adds xmlutil.parseString() which takes a string instead of a filename. The txAMQP-using application that I'm using uses pkg_resources.resource_string() to read the XML spec file in at runtime and then passes it to this new xmlutil.parseString() function. txAMQP itself, its unit tests and example files, could use the same technique so that they would be able to find the spec even if things had been moved around by deployment.