Replies: 4 comments
-
import fitz
FILENAME = "blueprint.1.pdf"
def do_some_analysis(doc, pageno):
page = doc[pageno - 1]
doc = fitz.open(FILENAME)
for i in range(doc.page_count):
page = doc[i]
print(i)
do_some_analysis(doc, i + 1) |
Beta Was this translation helpful? Give feedback.
-
Thank you @JorjMcKie , This script is only an example. We are writing a software analysis pdf files. I passed pdf name and page number to each module. Is there any other way to fix it? Thanks! |
Beta Was this translation helpful? Give feedback.
-
As long as I don't have a reproducing file, I cannot say much I am afraid.
I understand that that code is more symbolic than anything else, that's fine. |
Beta Was this translation helpful? Give feedback.
-
Let's convert this to a Discussion under the hypothesis there is no bug but only file errors. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
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)
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)
ubuntu 22.04
python 3.10.6
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
Beta Was this translation helpful? Give feedback.
All reactions