Changeset 14


Ignore:
Timestamp:
17.10.2008 10:28:56 (11 years ago)
Author:
marcus
Message:
  • improved: error output redirected to stderr
  • bugfix: clean exit if no stations left for processing after filtering
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Tools/ScXML2evt/scxml2evt.py

    r6 r14  
    1919    from lxml import etree 
    2020except ImportError: 
    21     print "fatal error: lxml module not found!" 
     21    print >> sys.stderr, "fatal error: lxml module not found!" 
    2222    sys.exit(1) 
    2323 
     
    5151            x = etree.parse(src, parser) 
    5252        except Exception, e: 
    53             print e 
     53            print >> sys.stderr, e 
    5454            sys.exit(3) 
    5555 
     
    111111 
    112112        # add event info to last pick 
    113         last = formatted[a["station"]] 
     113        try: 
     114            last = formatted[a["station"]] 
     115        except NameError: 
     116            # only if no stations left after filtering 
     117            print >> sys.stderr, "no picks on filtered station list" 
     118            sys.exit(4) 
     119 
    114120        for e in self.event: 
    115121            try: 
     
    140146        # no picks found 
    141147        if not len(picks_raw) or not len(arrivals_raw): 
    142             print "error: no pick or arrival information found" 
    143             print "error: maybe you have a very old version of libxml/libxslt" 
     148            print >> sys.stderr, "error: no pick or arrival information found" 
     149            print >> sys.stderr, "error: maybe you have a very old version of libxml/libxslt" 
    144150            sys.exit(4) 
    145151 
     
    207213        i = sys.argv[1] 
    208214    except IndexError: 
    209         print "error: please give source of seiscomp3 xmldump as command argument" 
     215        print >> sys.stderr, "error: please give source of seiscomp3 xmldump as command argument" 
    210216        sys.exit(2) 
    211217 
Note: See TracChangeset for help on using the changeset viewer.