alexdej / puzpy

Python library for reading and writing across lite crossword puzzle .puz files.
MIT License
112 stars 32 forks source link

Parsing fails when there is a notes section (global checksum does not match) #21

Closed brian-pantano closed 5 years ago

brian-pantano commented 5 years ago

Some examples are:

https://www.nytimes.com/crosswords/game/daily/2019/03/31 https://www.nytimes.com/crosswords/game/daily/2019/04/02 https://www.nytimes.com/crosswords/game/daily/2019/04/09

I attached .puz and .pdf files. The puz files are gziped since github won't let me attach .puz files directly.

Mar3119.puz.gz Apr0919.puz.gz Apr0219.puz.gz Mar3119.pdf Apr0219.pdf Apr0919.pdf

brian-pantano commented 5 years ago

Taking a look at the source, it looks like it's because

        if self.version.decode(ENCODING) == '1.3' and self.notes:
            cksum = data_cksum(self.notes.encode(ENCODING) + b'\0', cksum)

and for these files self.version.decode(ENCODING) is 1.4.

>= '1.3' will fix it until version 1.10, or you could split on dot, convert to int, and compare.

alexdej commented 5 years ago

Thanks for the bug report! I just pushed a fix for it. Will release to pypi soon