Skip to content

Can't parse Paratext project with empty tag <TranslationInfo /> #286

@laura-burdick-sil

Description

@laura-burdick-sil

Running this command:

python3 -c "
from machine.corpora.file_paratext_project_settings_parser import FileParatextProjectSettingsParser
from pathlib import Path
FileParatextProjectSettingsParser(Path('/root/M/Paratext/projects/XXXX')).parse()
"

(I've XXXX'ed out the specific Paratext project here, because I'm not sure if it's sensitive or not - you can message me, and I can tell you the name of it.)

gives this error:

Traceback (most recent call last):
  File "<string>", line 4, in <module>
  File "/workspaces/silnlp/.venv/lib/python3.10/site-packages/machine/corpora/paratext_project_settings_parser_base.py", line 98, in parse
    parent_name = translation_info_setting_parts[1] if translation_info_setting_parts[1] != "" else None
IndexError: list index out of range

This error is occurring because Settings.xml in the Paratext project has this empty tag: <TranslationInfo />. If I delete this line in Settings.xml, I don't get the error.

I originally ran into this using segment_verses.py in silnlp.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🔖 Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions