[Bugfix] Write header only, if export has been successfull.
This commit is contained in:
parent
85829b22eb
commit
f52b42f009
@ -190,20 +190,20 @@ class Data(object):
|
||||
elif fnext == '.obs':
|
||||
try:
|
||||
self.get_evt_data().write(fnout + fnext, format=evtformat)
|
||||
# write header afterwards
|
||||
evtdata = self.get_evt_data()
|
||||
evid = str(evtdata.resource_id).split('/')[1]
|
||||
header = '# EQEVENT: Label: EQ%s Loc: X 0.00 Y 0.00 Z 10.00 OT 0.00 \n' % evid
|
||||
nllocfile = open(fnout + fnext)
|
||||
l = nllocfile.readlines()
|
||||
nllocfile.close()
|
||||
l.insert(0, header)
|
||||
nllocfile = open(fnout + fnext, 'w')
|
||||
nllocfile.write("".join(l))
|
||||
nllocfile.close()
|
||||
except KeyError as e:
|
||||
raise KeyError('''{0} export format
|
||||
not implemented: {1}'''.format(evtformat, e))
|
||||
# write header afterwards
|
||||
evtdata = self.get_evt_data()
|
||||
evid = str(evtdata.resource_id).split('/')[1]
|
||||
header = '# EQEVENT: Label: EQ%s Loc: X 0.00 Y 0.00 Z 10.00 OT 0.00 \n' % evid
|
||||
nllocfile = open(fnout + fnext)
|
||||
l = nllocfile.readlines()
|
||||
nllocfile.close()
|
||||
l.insert(0, header)
|
||||
nllocfile = open(fnout + fnext, 'w')
|
||||
nllocfile.write("".join(l))
|
||||
nllocfile.close()
|
||||
|
||||
def getComp(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user