crossword icon indicating copy to clipboard operation
crossword copied to clipboard

Serialization via puz produces invalid file

Open rcoh opened this issue 6 years ago • 2 comments

The puzpy module relies on .fill being set to a string the same length as solution (width*height). This library doesn't set it which leads to corrupted files. Workaround:

puz = crossword.to_puz(crossword_obj)
puz.fill = ' ' * (crossword_obj.height * crossword_obj.width)
# workaround for a separate Python 3+ compatibility issue in puzpy
puz.preamble = b''
return puz.tobytes()

rcoh avatar Feb 26 '19 17:02 rcoh

Thanks for reporting this, it's indeed possible (likely) that this was missed when implementing this library. I'd have to look into it and create a fix for it.

Pull requests are welcome as well!

svisser avatar Feb 28 '19 16:02 svisser

In the same vein, clues can't be '' or Acrosslite will hard-crash. (many other readers are fine with it though)

rcoh avatar Mar 05 '19 18:03 rcoh