From 7add6858fc05775f1702377e9d05c5978f809ed3 Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Wed, 3 Mar 2021 16:17:14 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20ppn2ocr:=20Gracefully=20handle?= =?UTF-8?q?=20documents=20without=20DEFAULT,=20e.g.=20multi-volume=20works?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ppn2ocr | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ppn2ocr b/ppn2ocr index e7184e3..af6540b 100755 --- a/ppn2ocr +++ b/ppn2ocr @@ -99,6 +99,10 @@ def make_workspace(ppn, workspace): # Duplicate DEFAULT file group into a new file group MAX format_ = 'tif' file_grp_default = mets.find('//mets:fileGrp[@USE="DEFAULT"]', namespaces=XMLNS) + + if file_grp_default is None: + raise ValueError("This document has no DEFAULT file group, could be a multi-volume work") + file_grp_best = deepcopy(file_grp_default) file_grp_best.attrib['USE'] = 'MAX'