Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Exception
  • Loading branch information
Klaus Thoden committed Dec 20, 2018
1 parent cd7aa70 commit f799e9a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion idassigner.py
Expand Up @@ -11,6 +11,7 @@


import argparse import argparse
import logging import logging
import sys
from datetime import datetime from datetime import datetime
from lxml import etree from lxml import etree
from copy import deepcopy from copy import deepcopy
Expand All @@ -24,7 +25,11 @@
def assign_ids(chapter_tree): def assign_ids(chapter_tree):
"""Assign xml:ids to various elements""" """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) logging.debug("The id of this chapter is %s", chapter_id)


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

0 comments on commit f799e9a

Please sign in to comment.