-
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
doc.close() not closing the document #3081
Comments
With rebased, the file is kept open after So for example:
Arguably this new behaviour is ok, but we're looking at whether we could replicate the behaviour of |
In `Document.close()`, we reinstate call of `self._reset_page_refs()`. Also when converting between Fz and Pdf pages/documents, generate better error if document is None; this can happen if a document has been closed.
In `Document.close()`, we reinstate call of `self._reset_page_refs()`. Also when converting between Fz and Pdf pages/documents, generate better error if document is None; this can happen if a document has been closed.
Thanks for your help. After setting page to None the file is effectively closed. |
Fixed in 1.23.18. (There is now no need to set page to None.) |
Description of the bug
Hi,
doc.close() does not really close a pdf file. My python script does some checks using PyMuPDF, closes the file, compresses it by calling an external program and finally saves the original and copies the compressed file onto the original one. This yields an os error, indicating that the original file is in use by the current python process. Importing fitz_old as fitz instead of fitz works fine.
Thank you in advance for your effort fixing the problem and enhancing this excellent program.
How to reproduce the bug
PyMuPDF version
1.23.17
Operating system
Windows
Python version
3.10
The text was updated successfully, but these errors were encountered: