garcia / simfile

A modern simfile parsing & editing library for Python 3
MIT License
62 stars 7 forks source link

Opening a simfile fails with latest msdparser (2.0.0b3) #12

Closed wermipls closed 2 years ago

wermipls commented 2 years ago

Downgrading to msdparser==2.0.0b1 seems to resolve the issue for me.

Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import simfile
>>> simfile.open("Xuxa.sm")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\w\AppData\Local\Programs\Python\Python39\lib\site-packages\simfile\__init__.py", line 89, in open
    return open_with_detected_encoding(
  File "C:\Users\w\AppData\Local\Programs\Python\Python39\lib\site-packages\simfile\__init__.py", line 137, in open_with_detected_encoding
    return (load(file, strict=strict), encoding)
  File "C:\Users\w\AppData\Local\Programs\Python\Python39\lib\site-packages\simfile\__init__.py", line 63, in load
    is_ssc = _detect_ssc(peek_file)
  File "C:\Users\w\AppData\Local\Programs\Python\Python39\lib\site-packages\simfile\__init__.py", line 46, in _detect_ssc
    for first_key, _ in parser:
  File "C:\Users\w\AppData\Local\Programs\Python\Python39\lib\site-packages\msdparser\__init__.py", line 202, in parse_msd
    for token, value in lex_msd(
  File "C:\Users\w\AppData\Local\Programs\Python\Python39\lib\site-packages\msdparser\__init__.py", line 366, in lex_msd
    chunk = textio.read(4096)
  File "C:\Users\w\AppData\Local\Programs\Python\Python39\lib\site-packages\simfile\_private\tee_file.py", line 13, in __getattr__
    return getattr(self._file, name)
AttributeError: 'itertools._tee' object has no attribute 'read'
garcia commented 2 years ago

Thanks for flagging, and sorry about the breakage! I should have a simfile 2.1 beta out soon that plays nice with the msdparser beta.


In case anyone else encounters this: simfile 2.0 still uses msdparser 1.0 under the hood, and switching to the 2.0 beta isn't officially supported. Read here for more information on why you would want to switch to msdparser 2.0.0b1.

garcia commented 2 years ago

Not quite ready to commit to a new beta release yet, but I put up a PR at #13 that fixes compatibility with the latest msdparser beta.

garcia commented 2 years ago

I found out more recently that this was affecting people who did not explicitly install the msdparser beta. This is actually a bug in how the dependency was specified in simfile 2.0.0, so a new patch will be out shortly.