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.