From 6758f7fa202e3d6d6570212677af3129bb543703 Mon Sep 17 00:00:00 2001 From: M Pacer Date: Sat, 3 Mar 2018 17:31:48 -0800 Subject: [PATCH] checks if back exists before indexing into it; fixes #90 --- allofplos/article.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/allofplos/article.py b/allofplos/article.py index c82172eb..cc9268eb 100644 --- a/allofplos/article.py +++ b/allofplos/article.py @@ -57,7 +57,8 @@ def __str__(self, exclude_refs=True): if exclude_refs: root = tree.getroot() back = tree.xpath('./back') - root.remove(back[0]) + if back: + root.remove(back[0]) local_xml = et.tostring(tree, method='xml', encoding='unicode',