#113 Problems with xml.etree.ElementTree when PyXML is installed

open
nobody
None
5
2009-03-12
2009-03-12
Anonymous
No

I am finding that py2exe (0.6.9) does not include xml.etree.ElementTree or cElementTree in the build. In this case, PyXML is installed.

When specifying xml.etree.ElementTree in the 'packages' option to force the package to be included, py2exe will raise an ImportError. It looks like it assumes that modules that start with "xml" will always be under the _xmlplus parent.

Please see the attached sample python script and setup.py for a simple illustration.

Thanks.

Discussion

  • Sample setup.py

     
    Attachments
  • Sorry, could only upload one file. Here's the python script:

    #!/usr/bin/env python

    from xml.etree import ElementTree
    from xml.etree import cElementTree as CET

    def main():
    root = CET.Element("recipe", {"name": "chocolate brownies"})
    i1 = CET.SubElement(root, "ingredient", {"measurement": "200g"})
    i1.text = "chocolate"
    i2 = CET.SubElement(root, "ingredient", {"measurement": "100g"})
    i2.text = "butter"
    i3 = CET.SubElement(root, "ingredient", {"measurement": "1 cup"})
    i3.text = "self-raising flour"
    i4 = CET.SubElement(root, "ingredient", {"measurement": "4"})
    i4.text = "eggs"
    i5 = CET.SubElement(root, "ingredient", {"measurement": "1/3 cup"})
    i5.text = "brown sugar"
    print CET.tostring(root)

    if __name__ == "__main__":
    main()