crossword
crossword copied to clipboard
Serialization via puz produces invalid file
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()
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!
In the same vein, clues can't be ''
or Acrosslite will hard-crash. (many other readers are fine with it though)