|
[Rivet-svn] r3128 - trunk/pyextblackhole at projects.hepforge.org blackhole at projects.hepforge.orgSun Jun 5 21:51:27 BST 2011
Author: buckley Date: Sun Jun 5 21:51:26 2011 New Revision: 3128 Log: Auto-import ElementTree in lighthisto if it isn't already present with the expected name Modified: trunk/pyext/lighthisto.py Modified: trunk/pyext/lighthisto.py ============================================================================== --- trunk/pyext/lighthisto.py Sat Jun 4 23:54:13 2011 (r3127) +++ trunk/pyext/lighthisto.py Sun Jun 5 21:51:26 2011 (r3128) @@ -3,6 +3,21 @@ import posixpath import os, sys, re +if "ET" not in dir(): + try: + import xml.etree.cElementTree as ET + except ImportError: + logging.debug("Could not load module xml.etree.cElementTree," + " so we're on a Python < 2.5 system." + " Trying to load cElementTree...") + try: + import cElementTree as ET + except ImportError: + logging.warning("Could not load module cElementTree:" + " using slower xml.etree.ElementTree instead!") + import xml.etree.ElementTree as ET + + from htmlentitydefs import codepoint2name unichr2entity = {} for code, name in codepoint2name.iteritems():
More information about the Rivet-svn mailing list |