Skip to content

fail to read TextGrid files in utf8 BOM #11

@Bobo-alcazar

Description

@Bobo-alcazar

I tried to read a long form TextGrid file by textgrids package, which can be read by Praat 6.3.02 (GUI) successfully, but fail.
After annotation = textgrids.TextGrid('XXX.TextGrid') was inputed, this was what I get :

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python\Python39\lib\site-packages\textgrids\__init__.py", line 193, in __init__
    self.read(self.filename)
  File "C:\Python\Python39\lib\site-packages\textgrids\__init__.py", line 501, in read
    self.parse(data)
  File "C:\Python\Python39\lib\site-packages\textgrids\__init__.py", line 375, in parse
    raise TypeError
TypeError

Its a file in utf-8 with BOM. After I transformed it into utf-16 BE BOM form or utf-8 form without BOM, it can be read by textgrids package correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions