diff options
Diffstat (limited to 'rdflib/compat.py')
-rw-r--r-- | rdflib/compat.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/rdflib/compat.py b/rdflib/compat.py index 6c714894..f7ca4063 100644 --- a/rdflib/compat.py +++ b/rdflib/compat.py @@ -23,3 +23,30 @@ else: def numeric_greater(a, b): return a > b + + +try: + from lxml import etree + print("running with lxml.etree") +except ImportError: + try: + # Python 2.5 + import xml.etree.cElementTree as etree + print("running with cElementTree on Python 2.5+") + except ImportError: + try: + # Python 2.5 + import xml.etree.ElementTree as etree + print("running with ElementTree on Python 2.5+") + except ImportError: + try: + # normal cElementTree install + import cElementTree as etree + print("running with cElementTree") + except ImportError: + try: + # normal ElementTree install + import elementtree.ElementTree as etree + print("running with ElementTree") + except ImportError: + print("Failed to import ElementTree from any known place") |