From 9b3bc715980b51ffbf535bcf159ba4be03938c19 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sun, 20 Jun 1993 21:02:22 +0000 Subject: * aifc.py: don't die on invalid MARK chunk * calendar.py: remove stuff now built in time; some cleanup and generalization in the calendar printing * cmd.py: use __init__. * tzparse.py: This module is no longer necessary -- use builtin time instead! --- Lib/aifc.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'Lib/aifc.py') diff --git a/Lib/aifc.py b/Lib/aifc.py index 8c04ea30b3..7bdb9f0f62 100644 --- a/Lib/aifc.py +++ b/Lib/aifc.py @@ -563,11 +563,20 @@ class Aifc_read: def _readmark(self, chunk): nmarkers = _read_short(chunk) - for i in range(nmarkers): - id = _read_short(chunk) - pos = _read_long(chunk) - name = _read_string(chunk) - self._markers.append((id, pos, name)) + # Some files appear to contain invalid counts. + # Cope with this by testing for EOF. + try: + for i in range(nmarkers): + id = _read_short(chunk) + pos = _read_long(chunk) + name = _read_string(chunk) + self._markers.append((id, pos, name)) + except EOFError: + print 'Warning: MARK chunk contains only', + print len(self._markers), + if len(self._markers) == 1: print 'marker', + else: print 'markers', + print 'instead of', nmarkers class Aifc_write: # Variables used in this class: -- cgit v1.2.1