Bug #804

Etree output files use names like ns0 and ns1 not their default names

Added by Joseph Perry over 11 years ago. Updated almost 9 years ago.

Status:VerifiedStart date:
Priority:MediumDue date:
Assignee:Joseph Perry% Done:


Target version:Release 0.7
Google Code Legacy ID:archivematica-149 Pull Request:
Sponsored: Requires documentation:


The following web page has a solution to this:

[[ >>> my_namespaces = {'http://foo' : 'foo',

...                  'http://bar/' : bar}
>>> elementtree.ElementTree._namespace_map.update(my_namespaces)

ImportError: No module named elementtree.ElementTree


#1 Updated by Anonymous over 11 years ago

What implementation of ElementTree are you using, and what version of Python? It seems the XML scripts are all using xml.etree.cElementTree.

See the following: http://effbot.org/zone/element-namespaces.htm#element-tree-representation

"Adding global namespaces for older versions of cElementTree is a bit tricker; that library uses the ElementTree library for serialization, so you have to import the corresponding ElementTree version and modify its _namespace_map instead. cElementTree 1.0.6 and later provides a register_namespace function that does the right thing."

#2 Updated by Austin Trask about 11 years ago

maybe this will help:

first python-elementtree needs to be added to archivematica dependencies

then for ubuntu instead of import elementtree, use
import xml.etree.ElementTree

#3 Updated by Anonymous about 11 years ago

xml.etree.ElementTree is the version of ElementTree included in the standard library in Python versions 2.5 and higher; see http://docs.python.org/library/xml.etree.elementtree.html

#4 Updated by Joseph Perry almost 11 years ago

Problem solved using updated version of lxml.
sudo apt-get install python-lxml

#5 Updated by Joseph Perry almost 11 years ago

  • Status changed from New to Verified

Also available in: Atom PDF