Print stack trace on conversion errors
Change-Id: I887cf7641e01936abe2e7d6b589c557565643725
diff --git a/nor2tei.py b/nor2tei.py
index 693ed4b..5c67bdc 100644
--- a/nor2tei.py
+++ b/nor2tei.py
@@ -1,7 +1,8 @@
import os, sys
import xml.etree.ElementTree as ET
from xml.dom import minidom
-
+import traceback
+import sys
def main():
# Create corpus structure from string and save into file
@@ -21,13 +22,15 @@
# Process documents and append to corpus tree
for j in range(1, len(sys.argv)):
- try:
- currentTree = convert(j-1, sys.argv[j])
- currentRoot = currentTree.getroot()
- corpusRoot.append(currentRoot)
- except:
- print(sys.argv[j])
- continue
+ try:
+ currentTree = convert(j-1, sys.argv[j])
+ currentRoot = currentTree.getroot()
+ corpusRoot.append(currentRoot)
+ except:
+ print("ERROR:"+sys.argv[j])
+ print(traceback.format_exc())
+ print(sys.exc_info()[2])
+ continue
# Indent and save tree
ET.indent(corpusTree, " ")