From ba6a91469f1102d4d3961568cea7a90e92f2f32a Mon Sep 17 00:00:00 2001 From: Klaus Thoden Date: Wed, 14 Nov 2018 12:11:35 +0100 Subject: [PATCH] Fix path --- fix_tei.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fix_tei.py b/fix_tei.py index 686990d..8a98b55 100644 --- a/fix_tei.py +++ b/fix_tei.py @@ -48,8 +48,16 @@ TMP_DIR = os.path.expanduser("tmp_files") +RUNNING_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) +logging.debug("The script is run from {}".format(RUNNING_DIRECTORY)) +TEI_BOILERPLATE = os.path.sep.join([RUNNING_DIRECTORY, "data", "tei_boilerplate.cfg"]) +print(TEI_BOILERPLATE) +if not os.path.exists(TEI_BOILERPLATE): + logging.error("Could not find TEI boilerplate config. Exiting.") + sys.exit() + BOILERPLATES = configparser.ConfigParser() -BOILERPLATES.read("data/tei_boilerplate.cfg") +BOILERPLATES.read(TEI_BOILERPLATE) def get_place_in_xml_tree(element, tree): """Find out the position of an element in a tree.