Patch by Alberto Piai to address new integration of (c)elementtree into core python.
This commit is contained in:
parent
b013440c8b
commit
59d061c47f
@ -28,14 +28,22 @@
|
|||||||
# Things will be a lot faster and consume less memory if you install the
|
# Things will be a lot faster and consume less memory if you install the
|
||||||
# cElementTree module
|
# cElementTree module
|
||||||
#
|
#
|
||||||
|
# In python 2.5 cElementTree is in the core, so you don't need to install
|
||||||
|
# extra packages
|
||||||
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# Check for cElementTree presence. Otherwise use ElementTree.
|
# Check for cElementTree presence. Otherwise use ElementTree.
|
||||||
useiter = True
|
useiter = True
|
||||||
try:
|
try:
|
||||||
|
# python 2.5 has cElementTree in the core
|
||||||
|
import xml.etree.cElementTree as cElementTree
|
||||||
|
except:
|
||||||
|
# try the old way
|
||||||
|
try:
|
||||||
import cElementTree
|
import cElementTree
|
||||||
except ImportError:
|
except ImportError:
|
||||||
useiter = False
|
useiter = False
|
||||||
try:
|
try:
|
||||||
from elementtree import ElementTree
|
from elementtree import ElementTree
|
||||||
|
Loading…
Reference in New Issue
Block a user