[Bugfix] Write header only, if export has been successfull.

This commit is contained in:
Ludger Küperkoch 2017-06-28 12:40:03 +02:00
parent 85829b22eb
commit f52b42f009

View File

@ -190,9 +190,6 @@ class Data(object):
elif fnext == '.obs': elif fnext == '.obs':
try: try:
self.get_evt_data().write(fnout + fnext, format=evtformat) self.get_evt_data().write(fnout + fnext, format=evtformat)
except KeyError as e:
raise KeyError('''{0} export format
not implemented: {1}'''.format(evtformat, e))
# write header afterwards # write header afterwards
evtdata = self.get_evt_data() evtdata = self.get_evt_data()
evid = str(evtdata.resource_id).split('/')[1] evid = str(evtdata.resource_id).split('/')[1]
@ -204,6 +201,9 @@ class Data(object):
nllocfile = open(fnout + fnext, 'w') nllocfile = open(fnout + fnext, 'w')
nllocfile.write("".join(l)) nllocfile.write("".join(l))
nllocfile.close() nllocfile.close()
except KeyError as e:
raise KeyError('''{0} export format
not implemented: {1}'''.format(evtformat, e))
def getComp(self): def getComp(self):
""" """