cfculhane / AnkiOCR

Anki Addon to create searchable text from images in notes, using Tesseract OCR
MIT License
17 stars 5 forks source link

Error after Anki 2.1.64 #41

Open Gabrusp opened 1 year ago

Gabrusp commented 1 year ago

Hello, first of all, thank you for this amazing addon. Unfortunately, it no longer works on Anki versions after 2.1.64. When I try to use it, I get the error below:

Error encountered during processing. Debug info: Anki Version: 23.10 , AnkiOCR Version: 0.7.1 Platform: Windows , Python Version: 3.9.15 (main, Nov 6 2022, 02:45:15) [MSC v.1929 64 bit (AMD64)]Traceback (most recent call last): File "C:\Users\XXXXX\AppData\Roaming\Anki2\addons21\450181164\gui.py", line 58, in on_run_ocr ocr.run_ocr_on_notes(note_ids=selected_nids) File "C:\Users\XXXXX\AppData\Roaming\Anki2\addons21\450181164\ocr.py", line 309, in run_ocr_on_notes notes_query = self.run_ocr_on_query(note_ids=note_ids) File "C:\Users\XXXXX\AppData\Roaming\Anki2\addons21\450181164\ocr.py", line 279, in run_ocr_on_query raw_results = self._ocr_batch_process(batched_txts=batched_txts) File "C:\Users\XXXXX\AppData\Roaming\Anki2\addons21\450181164\ocr.py", line 97, in _ocr_batch_process raw_results[batched_img_txt] = future.result() File "concurrent.futures._base", line 439, in result File "concurrent.futures._base", line 391, in __get_result File "concurrent.futures.thread", line 58, in run File "C:\Users\XXXXX\AppData\Roaming\Anki2\addons21\450181164\ocr.py", line 265, in _ocr_img return pytesseract.image_to_string(str(img_pth), lang="+".join(languages or ["eng"]), File "C:\Users\XXXXX\AppData\Roaming\Anki2\addons21\450181164_vendor\pytesseract\pytesseract.py", line 416, in image_to_string return { File "C:\Users\XXXXX\AppData\Roaming\Anki2\addons21\450181164_vendor\pytesseract\pytesseract.py", line 419, in Output.STRING: lambda: run_and_get_output(*args), File "C:\Users\XXXXX\AppData\Roaming\Anki2\addons21\450181164_vendor\pytesseract\pytesseract.py", line 287, in run_and_get_output run_tesseract(**kwargs) File "C:\Users\XXXXX\AppData\Roaming\Anki2\addons21\450181164_vendor\pytesseract\pytesseract.py", line 263, in run_tesseract raise TesseractError(proc.returncode, get_errors(error_string)) 450181164._vendor.pytesseract.pytesseract.TesseractError: (1, "read_params_file: Can't open txt Tesseract Open Source OCR Engine v5.0.0-alpha.20200328 with Leptonica Error in fopenReadStream: file not found Error in pixRead: image file not found: C:\Users\XXXXX\AppData\Roaming\Anki2\Usuário 1\collection.media\paste-32998233735169.jpg Image file C:\Users\XXXXX\AppData\Roaming\Anki2\Usuário 1\collection.media\paste-32998233735169.jpg cannot be read! Error during processing.")

Gabrusp commented 1 year ago

I noticed that AnkiOCR uses the distutils module, so maybe it's related:

https://github.com/ankitects/anki/pull/2723