Skip to content

Commit

Permalink
Recover from a broken Cn (by Michael Fox, ported to Python 3)
Browse files Browse the repository at this point in the history
Commit fbab53aa19d1aea43ff3ab2ace15058945f2e49 from cmars#1 ported to Python 3.
  • Loading branch information
florisla committed Jul 12, 2018
1 parent 679ba90 commit 1ad79f6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pystdf/IO.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ def parse_records(self, count=0):
if len(fields) < len(recType.columnNames):
fields += [None] * (len(recType.columnNames) - len(fields))
self.send((recType, fields))
if header.len > 0:
print(
"Warning: Broken header. Unprocessed data left in record of type '%s'. Working around it." % recType.__class__.__name__,
file=sys.stderr,
)
self.inp.read(header.len)
header.len = 0
else:
self.inp.read(header.len)
if count:
Expand Down

0 comments on commit 1ad79f6

Please sign in to comment.