-
Notifications
You must be signed in to change notification settings - Fork 664
Closed
Labels
Description
@JorjMcKie what do you make of this? It started in 1.18.7:
>>> from pathlib import Path
>>> f = Path("specAndDatabase") / "input.pdf" # short name
>>> fitz.open(f)
Document('input.pdf')So far so good, try again with longer filename:
>>> f = Path("specAndDatabase") / "input12345678.pdf" # long filename
>>> fitz.open(f)
mupdf: cannot open input12345678.pdf: No such file or directory
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-37-7a249489c678> in <module>
----> 1 fitz.open(f)
~/.local/lib/python3.9/site-packages/fitz/fitz.py in __init__(self, filename, stream, filetype, rect, width, height, fontsize)
3634 _fitz.Document_swiginit(
3635 self,
-> 3636 _fitz.new_Document(
3637 filename, stream, filetype, rect, width, height, fontsize
3638 ),
RuntimeError: cannot open input12345678.pdf: No such file or directoryWithout the Path, it works fine:
>>> f = "specAndDatabase/input12345678.pdf"
>>> fitz.open(f)
Document('specAndDatabase/input12345678.pdf')
It looks (from the error message) that it strips the directory from a path if the filename is too long (or maybe of the whole thing is too long, haven't dug deeper yet).
To Reproduce (mandatory)
Create pdf file named input.pdf and input12345678.pdf and put in directory as shown above. Follow steps above.
Your configuration (mandatory)
3.9.1 (default, Dec 8 2020, 00:00:00)
[GCC 10.2.1 20201125 (Red Hat 10.2.1-9)]
linux
PyMuPDF 1.18.7: Python bindings for the MuPDF 1.18.0 library.
Version date: 2021-01-31 00:00:01.
Built for Python 3.9 on linux (64-bit).
redpanda1234