Open timnbvc opened 2 years ago
Thanks for this, seems like a relatively simple fix, but I also need to update this addon to work with newer versions of anki.
I'm flat out with my final year of medical school, so I probably won't get time for this for another month or so, unfortunately, sorry!
On Fri, 24 Jun 2022 at 15:20, timnbvc @.***> wrote:
Hello,
when im trying to to use the ankiocr I'll get an error message on some cards . Not on every card but on such which have a special letter like "ä ö ü" in the name of the card.
For example: If the cards name is: "Hola ÜK.jpg" it will not work
This is the error message:
__Error encountered during processing. Debug info: Anki Version: 2.1.49 , AnkiOCR Version: 0.7.1 Platform: Darwin , Python Version: 3.8.6 (v3.8.6:db455296be, Sep 23 2020, 13:31:39) [Clang 6.0 (clang-600.0.57)]Traceback (most recent call last): File "/UsersLibrary/Application Support/Anki2/addons21/450181164/gui.py", line 58, in on_run_ocr ocr.run_ocr_on_notes(note_ids=selected_nids) File "/Users/Library/Application Support/Anki2/addons21/450181164/ocr.py", line 309, in run_ocr_on_notes notes_query = self.run_ocr_on_query(note_ids=note_ids) File "/Users//Library/Application Support/Anki2/addons21/450181164/ocr.py", line 277, in run_ocr_on_query batched_txts, batched_txts_dir, batch_mapping = self.
gen_batched_txts(notes_to_process=notes_query.notes, File "/Users//Library/Application Support/Anki2/addons21/450181164/ocr.py", line 228, in gen_batched_txts batch_txt_pth.write_text("\n".join([str(i.img_pth) for i in batched_imgs])) File "pathlib.py", line 1255, in write_text UnicodeEncodeError: 'ascii' codec can't encode character '\xdc' in position 78: ordinal not in range(128)
— Reply to this email directly, view it on GitHub https://github.com/cfculhane/AnkiOCR/issues/34, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJRYIU45FEPIFOPLM4T5LTLVQVASHANCNFSM5ZWRWQYQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Try changing this : batch_txt_pth.write_text("\n".join([str(i.img_pth) for i in batched_imgs]))
By this : batch_txt_pth.write_text("\n".join([str(i.img_pth) for i in batched_imgs]), encoding='utf-8')
It worked for me!
Hello,
when im trying to to use the ankiocr I'll get an error message on some cards . Not on every card but on such which have a special letter like "ä ö ü" in the name of the card.
For example: If the cards name is: "Hola ÜK.jpg" it will not work
This is the error message:
Error encountered during processing. Debug info: Anki Version: 2.1.49 , AnkiOCR Version: 0.7.1 Platform: Darwin , Python Version: 3.8.6 (v3.8.6:db455296be, Sep 23 2020, 13:31:39) [Clang 6.0 (clang-600.0.57)]Traceback (most recent call last): File "/UsersLibrary/Application Support/Anki2/addons21/450181164/gui.py", line 58, in on_run_ocr ocr.run_ocr_on_notes(note_ids=selected_nids) File "/Users/Library/Application Support/Anki2/addons21/450181164/ocr.py", line 309, in run_ocr_on_notes notes_query = self.run_ocr_on_query(note_ids=note_ids) File "/Users//Library/Application Support/Anki2/addons21/450181164/ocr.py", line 277, in run_ocr_on_query batched_txts, batched_txts_dir, batch_mapping = self._gen_batched_txts(notes_to_process=notes_query.notes, File "/Users//Library/Application Support/Anki2/addons21/450181164/ocr.py", line 228, in _gen_batched_txts batch_txt_pth.write_text("\n".join([str(i.img_pth) for i in batched_imgs])) File "pathlib.py", line 1255, in write_text UnicodeEncodeError: 'ascii' codec can't encode character '\xdc' in position 78: ordinal not in range(128)