Changeset 2617 for TI02-CSML


Ignore:
Timestamp:
20/06/07 08:07:57 (12 years ago)
Author:
domlowe
Message:

changing elementtree imports to handle python 2.5, 2.4 + eggs

Location:
TI02-CSML/trunk/csml
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/csml/parser.py

    r2526 r2617  
    1 import cElementTree as ET 
    2 import elementtree.ElementTree as etree 
     1#import cElementTree as ET 
     2#import elementtree.ElementTree as etree 
     3try: #python 2.5 
     4    from xml.etree import ElementTree as etree 
     5except ImportError: 
     6    try: 
     7        # if you've installed it yourself it comes this way 
     8        import ElementTree as etree 
     9    except ImportError: 
     10        # if you've egged it this is the way it comes 
     11        from elementtree import ElementTree as etree 
     12 
     13try: #python 2.5 
     14    from xml.etree import cElementTree as ET 
     15except ImportError: 
     16    try: 
     17        # if you've installed it yourself it comes this way 
     18        import cElementTree as ET 
     19    except ImportError: 
     20        # if you've egged it this is the way it comes 
     21        from celementtree import cElementTree as ET 
     22 
     23 
     24 
     25 
     26 
     27 
     28 
     29 
    330import sys, traceback 
    431import csml 
  • TI02-CSML/trunk/csml/parser_extra.py

    r2526 r2617  
    1010import csml.parser 
    1111import sys 
    12 import elementtree.ElementTree as etree 
     12try: #python 2.5 
     13    from xml.etree import ElementTree as etree 
     14except ImportError: 
     15    try: 
     16        # if you've installed it yourself it comes this way 
     17        import ElementTree as etree 
     18    except ImportError: 
     19        # if you've egged it this is the way it comes 
     20        from elementtree import ElementTree as etree 
    1321import string 
    1422import cElementTree as ET 
Note: See TracChangeset for help on using the changeset viewer.