Commit 70b4fbc9 authored by Maeva Pourpoint's avatar Maeva Pourpoint
Browse files

Merge branch 'passoft_py3_bugs' into 'master'

Fix "error writing fixed header" bug

See merge request !9
parents 4e88f0af cd875f29
Pipeline #1151 passed with stage
in 40 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()
......@@ -561,16 +561,19 @@ class Mseed(futils):
SeqNum = self.Pad(hdrlist[0][0], 6) # SeqNum
DQual = hdrlist[0][1] # DataQual
Res = hdrlist[0][2] # Reserved
try:
Stat = self.Pad(hdrlist[0][3], 5).encode() # Stat
Loc = self.Pad(hdrlist[0][4], 2).encode() # Loc
Chan = self.Pad(hdrlist[0][5], 3).encode() # Chan
Net = self.Pad(hdrlist[0][6], 2).encode() # Net
except AttributeError:
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
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"
......@@ -603,8 +606,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
#########################################################
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment