Thursday, March 12, 2009

'module' object has no attribute 'tostring' - elementtree with py2exe compiled django app

In that Django py2exe compiled app, I am making use of ElementTree. Code that worked properly on my development server was complaining about the ElementTree module I was using not having a tostring method.

Really? Since when does xml.etree.cElementTree (using Python 2.5 here) not have a tostring method?

The answer? When xml.etree.ElementTree isn't present. A number of the cElementTree methods are merely mapped to the ElementTree module, so if the xml.etree.ElementTree isn't included along with xml.etree.cElementTree in the py2exe includes, cElementTree will be missing components.

No comments:

Post a Comment