debugging: return the exception text whenever an error occurs - makes debugging much easier

This commit is contained in:
Sebastian Wehling-Benatelli 2015-04-22 12:38:10 +02:00
parent 58aad840c8
commit ca8081b7aa

View File

@ -3,15 +3,13 @@
import os import os
import numpy as np
from obspy.core import (read, Stream, UTCDateTime) from obspy.core import (read, Stream, UTCDateTime)
from obspy import readEvents from obspy import readEvents
from obspy.core.event import (Event, Catalog) from obspy.core.event import (Event, Catalog)
from pylot.core.read import readPILOTEvent from pylot.core.read import readPILOTEvent
from pylot.core.util import fnConstructor, FormatError, \
from pylot.core.util import fnConstructor, createEvent, FormatError, \ getGlobalTimes
prepTimeAxis, getGlobalTimes
class Data(object): class Data(object):
@ -129,8 +127,8 @@ class Data(object):
except TypeError: except TypeError:
try: try:
self.wfdata += read(fname, format='GSE2') self.wfdata += read(fname, format='GSE2')
except Exception: except Exception, e:
warnmsg += '{0}\n'.format(fname) warnmsg += '{0}\n{1}\n'.format(fname, e)
if warnmsg: if warnmsg:
warnmsg = 'WARNING: unable to read\n' + warnmsg warnmsg = 'WARNING: unable to read\n' + warnmsg
print warnmsg print warnmsg