Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save results in AttributeError and zero-byte .puz file #19

Closed
pwinn opened this issue Mar 13, 2019 · 6 comments · Fixed by #20
Closed

Save results in AttributeError and zero-byte .puz file #19

pwinn opened this issue Mar 13, 2019 · 6 comments · Fixed by #20

Comments

@pwinn
Copy link

pwinn commented Mar 13, 2019

Version 1.0.3. I open any puzzle and hit ^S to save, receiving:

Traceback (most recent call last):
  File "/Users/x/Library/Python/3.7/bin/cursewords", line 10, in <module>
    sys.exit(main())
  File "/Users/x/Library/Python/3.7/lib/python/site-packages/cursewords/cursewords.py", line 902, in main
    grid.save(filename)
  File "/Users/x/Library/Python/3.7/lib/python/site-packages/cursewords/cursewords.py", line 263, in save
    self.puzfile.save(filename)
  File "/Users/x/Library/Python/3.7/lib/python/site-packages/puz.py", line 226, in save
    f.write(self.tobytes())
  File "/Users/x/Library/Python/3.7/lib/python/site-packages/puz.py", line 273, in tobytes
    s.write(self.postscript.encode(ENCODING))
AttributeError: 'bytes' object has no attribute 'encode'

At this point I am at a prompt and my .puz file is now zero bytes.

@thisisparker
Copy link
Owner

Oh no, I'm sorry and I hope you're not losing data. Is this happening with puz files from different sources? Would it be possible to upload or send me one of the puz files that is causing this issue for you? (Also, would you be interested in testing open/save with a "known good" file I sent you?)

(From the traceback it looks like this is an upstream issue with the puzpy library, but I'm definitely interested in getting to the bottom of it.)

@pwinn
Copy link
Author

pwinn commented Mar 14, 2019

Fortunately, I copied these files onto the computer in question, so I still have the originals. And you're right, all of them were from the same original source. I'll try some puzzles from other sources and let you know the result.

I don't think these puzzles are public domain, but I can provide one to you directly.

@thisisparker
Copy link
Owner

If email works, I'm parker at parkerhiggins dot net, and I'd be happy to take a look. Even if it's totally an upstream issue I can probably submit a fix!

@thisisparker
Copy link
Owner

Thank you for emailing me the puzzles! I identified the issue and it is an upstream bug, and I've opened an issue on the repo. There's a sort of quick & dirty hack I could do to sidestep the problem downstream in cursewords, but I'd rather it get fixed for everybody if that's possible.

@pwinn
Copy link
Author

pwinn commented Mar 14, 2019

Thank you for being so responsive and tracking it down!

@thisisparker
Copy link
Owner

Thanks for reporting! I was able to get the upstream fix merged in and I've bumped the dependency version, so it should Just Work on v1.0.4. You can uninstall and reinstall or upgrade to get the new version. Please let me know if it works for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants