Skip to content
Permalink
Browse files

Exception

  • Loading branch information...
kthoden committed Dec 20, 2018
1 parent cd7aa70 commit f799e9a12aa5ac7aa7dfc365f3cd8f9f3a6d587f
Showing with 6 additions and 1 deletion.
  1. +6 −1 idassigner.py
@@ -11,6 +11,7 @@

import argparse
import logging
import sys
from datetime import datetime
from lxml import etree
from copy import deepcopy
@@ -24,7 +25,11 @@
def assign_ids(chapter_tree):
"""Assign xml:ids to various elements"""

chapter_id = (chapter_tree.attrib["{http://www.w3.org/XML/1998/namespace}id"])
try:
chapter_id = (chapter_tree.attrib["{http://www.w3.org/XML/1998/namespace}id"])
except KeyError:
logging.error("Chapter has no id. Exiting")
sys.exit()
logging.debug("The id of this chapter is %s", chapter_id)

footnotes = chapter_tree.xpath("//t:note[@place='bottom']", namespaces=NS_MAP)

0 comments on commit f799e9a

Please sign in to comment.
You can’t perform that action at this time.