-
Notifications
You must be signed in to change notification settings - Fork 678
Description
Please provide all mandatory information!
Describe the bug (mandatory)
When open pdf file in multiple functions, sometimes I got runtimeerror: cycle in page tree.
It doesn't happen to every pdf. Sometimes, when the error happens, if I change the pdf file path from absolute path to relative path, the problem will be gone.
To Reproduce (mandatory)
import fitz
FILENAME='blueprint (1).pdf'
def do_some_analysis(filename,pageno):
doc=fitz.open(filename)
page=doc[pageno-1]
doc=fitz.open(FILENAME)
for i in range(doc.page_count):
page=doc[i]
print(i)
do_some_analysis(FILENAME,i+1)
For problems when building or installing PyMuPDF, give the full output of the build/install command so that, for example, all pip/compiler/linker errors/warnings can be seen.
Expected behavior (optional)
Describe what you expected to happen (if not obvious).
Screenshots (optional)
If applicable, add screenshots to help explain your problem.
For the same file, running the code snippet
when I use absolute path

when I use relative path

Your configuration (mandatory)
- Operating system, potentially version and bitness
ubuntu 22.04 - Python version, bitness
python 3.10.6 - PyMuPDF version, installation method (wheel or generated from source).
pip install pymupdf
version 1.21.0
For example, the output of print(sys.version, "\n", sys.platform, "\n", fitz.__doc__) would be sufficient (for the first two bullets).
3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0]
linux
PyMuPDF 1.21.0: Python bindings for the MuPDF 1.21.0 library.
Version date: 2022-11-08 00:00:01.
Built for Python 3.10 on linux (64-bit).
Additional context (optional)
Add any other context about the problem here.
blueprint (1).pdf