Praat-textgrids icon indicating copy to clipboard operation
Praat-textgrids copied to clipboard

fail to read TextGrid files in utf8 BOM

Open Bobo-alcazar opened this issue 2 years ago • 0 comments

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.

Bobo-alcazar avatar Jan 06 '23 15:01 Bobo-alcazar