docling icon indicating copy to clipboard operation
docling copied to clipboard

Bug

Open TanNguyenKhac opened this issue 2 years ago • 5 comments

Bug

PermissionError: [Errno 13] Permission denied: 'C:\Users\Dell\AppData\Local\Temp\tempxxxxx.png'

Steps to reproduce

unable to run Force full page OCR. in line: fp = builtins.open(filename, "w+b")

Docling version

2.5.2

Python version

3.11

TanNguyenKhac avatar Nov 19 '24 03:11 TanNguyenKhac

Can you please provide more details on which OCR engine you are using?

dolfim-ibm avatar Nov 19 '24 04:11 dolfim-ibm

I use TesseractCliOcrOptions.

TanNguyenKhac avatar Nov 19 '24 06:11 TanNguyenKhac

This OCR engine requires writing temporary files to the disk. The files are saved in the temporary location provided by the Python tempfile module.

If your user doesn't have write permissions in that folder, you might be able to provide another location via the TMPDIR environment variable. See the documentation of the tempfile.gettempdir() function.

dolfim-ibm avatar Nov 19 '24 07:11 dolfim-ibm

thanks for your response, I've checked the permission carefully, the error seems that this .png file is being opened by a function, I've tried adding: if os.path.exists(fname): os.remove(fname) before the save step, the program runs normally. And let me ask more, is there any support for detecting horizontal rotation for this version 2.5.2 and how to add train language file. thank @dolfim-ibm .

TanNguyenKhac avatar Nov 19 '24 07:11 TanNguyenKhac

Good, happy you could solve your issue.

Regarding your questions:

  1. OCR train language should be addressed with the OCR engines.
  2. Rotation is captured for programmatic documents, but for scanned one, we rely on the OCR engine being able to capture it.

dolfim-ibm avatar Nov 19 '24 08:11 dolfim-ibm