Troubleshooting HTR/OCR Imports
The following issues apply to the HTR/OCR import paths (Transkribus TEI export, PAGE XML, and ALTO XML) described in the LEAF-Turning Engine Documentation.
"No XML files found" error The script expects a folder path, not a file path. Make sure you're pointing the script at the folder that contains your XML files, not at an individual file or a zip archive:
# Correct — points at the folder
python3 htr_merge_and_transform.py ./my_pages/ output.xml --format page
# Wrong — points at a single file
python3 htr_merge_and_transform.py ./my_pages/page001.xml output.xml --format page
If you have a zip archive, unzip it first and then point the script at the resulting folder.
"XSLT not found" error
Make sure alto-to-tei.xsl and page-to-tei.xsl are in the same folder as htr_merge_and_transform.py, and that you're running the script from that folder.
"pip is not recognized" (Windows) Python was not added to your PATH during installation. Reinstall Python from python.org and tick "Add Python to PATH" during setup.
"python3: command not found" (Mac)
Try python instead of python3, or install Python from python.org.
Pages appear out of order
The script processes files in alphabetical order by filename. If your files don't sort alphabetically in page order (e.g. page1.xml, page10.xml, page2.xml), rename them with zero-padded numbers (e.g. page_001.xml, page_002.xml, page_010.xml) before running the script.
Text from some regions is missing Check that your XML files contain transcribed text and are not empty segmentation files. In eScriptorium, make sure you select the correct transcription version when exporting.
LEAF-Writer reports the file is not well-formed
Try running the script again and re-uploading. If the problem persists, open the output XML file in a text editor and check that it begins with <?xml version="1.0".