-
Notifications
You must be signed in to change notification settings - Fork 510
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
NameError: name 'unicode' is not defined (line 2760 in 'fitz.py') #466
Comments
Sorry, cannot reproduce this error. |
The next version will have the following change in behavior: This avoids more imports and still supports filenames provided as |
New version 1.16.14 is on PyPI. |
On 1.16.11, I could hit something like using pathlib. from pathlib import Path
p = Path('hello.pdf') then doc = fitz.open()
doc.newPage()
doc.save(p)
~/.local/lib/python3.7/site-packages/fitz/fitz.py in save(self, filename, garbage, clean, deflate, incremental, ascii, expand, linear, pretty, encryption, permissions, owner_pw, user_pw)
2673 if type(filename) == str:
2674 pass
-> 2675 elif type(filename) == unicode:
2676 filename = filename.encode('utf8')
2677 else:
NameError: name 'unicode' is not defined >>> fitz.version
('1.16.11', '1.16.0', '20200221154027') But upgrading to 1.16.14 fixed it for me. |
@cbm755 - thank your for the feedback! |
Please provide all mandatory information!
Describe the bug (mandatory)
line 2760 in 'fitz.py': (in 'save' function)
elif type(filename) == unicode:
NameError: name 'unicode' is not defined
To Reproduce (mandatory)
doc = fitz.open()
doc.newPage()
doc.save('save_test.pdf')
Expected behavior (optional)
Should save the file without error.
Screenshots (optional)
Your configuration (mandatory)
Windows 10 64-bit
Python 3.7.2 64-bit
PyMuPDF 1.16.13
Additional context (optional)
Fixed by adding
from past.builtins import unicode
to top of 'fitz.py'.The text was updated successfully, but these errors were encountered: