Skip to content
Snippets Groups Projects
Commit 9bbb8db8 authored by Maeva Pourpoint's avatar Maeva Pourpoint
Browse files

Merge branch 'passoft_py3_bugs' into 'master'

Update code to handle "error writing fixed header" bug

See merge request passoft/ckMseed!10
parents 101d26b5 abc484fc
No related branches found
No related tags found
1 merge request!10Update code to handle "error writing fixed header" bug
Pipeline #1139 passed with stage
in 37 seconds
......@@ -141,7 +141,7 @@ class futils:
"""
def __init__(self, infile):
self.infile = open(infile, 'rb')
self.infile = open(infile, 'r+b')
def close(self):
self.infile.close()
......@@ -570,10 +570,19 @@ class Mseed(futils):
SeqNum = self.Pad(hdrlist[0][0], 6) # SeqNum
DQual = hdrlist[0][1] # DataQual
Res = hdrlist[0][2] # Reserved
Stat = self.Pad(hdrlist[0][3], 5) # Stat
Loc = self.Pad(hdrlist[0][4], 2) # Loc
Chan = self.Pad(hdrlist[0][5], 3) # Chan
Net = self.Pad(hdrlist[0][6], 2) # Net
if isinstance(Stat, str):
Stat = Stat.encode()
if isinstance(Loc, str):
Loc = Loc.encode()
if isinstance(Chan, str):
Chan = Chan.encode()
if isinstance(Net, str):
Net = Net.encode()
# time info
# fmtstr1 = fmtorderstr + "HHBBBBH"
......@@ -605,8 +614,8 @@ class Mseed(futils):
self.infilewrite(pack_hdr)
return 48
except Exception:
print("error writing fixed header")
except Exception as e:
print("error writing fixed header - {}".format(e))
return 0
#########################################################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment