From 7741c4de01c23b363cf6161750865d37cdee3e72 Mon Sep 17 00:00:00 2001 From: Ed Summers Date: Wed, 26 Jul 2017 12:11:38 -0400 Subject: [PATCH] MARCMaker error Now pymarc will at least complain about the record length being invalid rather than throwing a ValueError because it can't convert =LDR into an integer. --- pymarc/reader.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pymarc/reader.py b/pymarc/reader.py index 1aa6858..847e32c 100644 --- a/pymarc/reader.py +++ b/pymarc/reader.py @@ -87,7 +87,11 @@ def __next__(self): if len(first5) < 5: raise RecordLengthInvalid - length = int(first5) + try: + length = int(first5) + except ValueError: + raise RecordLengthInvalid + chunk = self.file_handle.read(length - 5) chunk = first5 + chunk record = Record(chunk,