docling-project / docling-project/docling
It says "Input pdf "filename.pdf" is not valid, when ran as an .exe
- Dominant language
- Python
- Stars
- 66.4k
- Forks
- 4.8k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 84
Description
### Bug
I have four python files out of which one contains the docling library and a user defined function which extracts the pdf content to markdown.
```python
def convert_pdf_to_text(pdf_path, callback=None, should_stop=None):
"""Convert PDF to text using docling library."""
try:
if should_stop and should_stop():
print_message("PDF conversion cancelled", callback)
return None
pipeline_options = PdfPipelineOptions(
enable_ocr=True,
do_table_structure=True,
detect_language=True,
layout_mode="accurate"
)
if should_stop and should_stop():
print_message("PDF conversion cancelled", callback)
return None
converter = DocumentConverter(format_options={
InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)
})
if should_stop and should_stop():
print_message("PDF conversion cancelled", callback)
return None
print_message(str(pdf_path), callback)
result = converter.convert(pdf_path)
if should_stop and should_stop():
print_message("PDF conversion cancelled", callback)
return None
return result.document.export_to_markdown()
except Exception as e:
print_message(str(pdf_path), callback)
print_message(f"Error during PDF conversion: {str(e)}", callback)
return None
````
This file called from main.py. If I run main.py the program is running without any issues, but if convert it using pyinstaller as exe and I run it then it says : Input pdf "filename.pdf" is not valid.
I converted the program to exe using the following command
pyinstaller --onefile --noconsole main.py
### Steps to reproduce
...
### Docling version
docling 2.36.0
### Python version
python 3.12.10
Contributor guide
Assessment
This issue has not been assessed yet.