Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading fails if DEL present in multi-line interval annotation #22

Open
mr-martian opened this issue Apr 19, 2022 · 3 comments
Open

Loading fails if DEL present in multi-line interval annotation #22

mr-martian opened this issue Apr 19, 2022 · 3 comments
Assignees

Comments

@mr-martian
Copy link

The following TextGrid does not load:
DEL.TextGrid.txt

If either the DEL (ASCII 7f) character or the newline is removed from the annotation, the file loads fine, but if both are present I get

>>> tgt.io.read_textgrid('DEL.TextGrid')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/daniel/.local/lib/python3.8/site-packages/tgt/io3.py", line 51, in read_textgrid
    return read_long_textgrid(filename, stg, include_empty_intervals)
  File "/home/daniel/.local/lib/python3.8/site-packages/tgt/io3.py", line 158, in read_long_textgrid
    num_obj = int(get_attr_val(stg[index + 5]))
IndexError: list index out of range
@mr-martian
Copy link
Author

It looks like the issue is that the parser assumes that if there is a newline in an annotation, then it will be the last character before the quotation, but the textgrid that raised the issue for some reason had a DEL after the \n. (It's also entirely unclear to me why Praat generated this in the file.)

@hbuschme hbuschme self-assigned this Apr 22, 2022
@hbuschme
Copy link
Owner

Could you perhaps provide a sample file where the problem occurs?

@mr-martian
Copy link
Author

That's DEL.TextGrid from the post (added .txt so github would allow it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants