mentheosis / anki-scanner-chinese-redux

adding text scanning features for chinese redux in anki
GNU General Public License v3.0
5 stars 5 forks source link

Index string error #16

Open camerooncameroon opened 2 years ago

camerooncameroon commented 2 years ago

Hi, trying to scan any Chinese text results in error:

Caught exception:
Traceback (most recent call last):
  File "C:\Users\Asus\AppData\Roaming\Anki2\addons21\2121493325\mr_async_worker_thread.py", line 60, in run
    self.new_char_words, self.new_words, self.new_chars, self.printSummary = sc.scan_and_print(self.file_to_scan, self.file_or_dir, self.input_encoding, self.scan_mode)
  File "C:\Users\Asus\AppData\Roaming\Anki2\addons21\2121493325\mr_text_scanner.py", line 295, in scan_and_print
    scanned_words, anki_words, left_diff, intersect, scanned_chars, anki_chars, char_diff, char_intersect = self.scan_and_compare(
  File "C:\Users\Asus\AppData\Roaming\Anki2\addons21\2121493325\mr_text_scanner.py", line 278, in scan_and_compare
    self.load_words_from_anki_notes()
  File "C:\Users\Asus\AppData\Roaming\Anki2\addons21\2121493325\mr_text_scanner.py", line 208, in load_words_from_anki_notes
    simp, trad = self.try_get_word_basics(word)
  File "C:\Users\Asus\AppData\Roaming\Anki2\addons21\2121493325\mr_text_scanner.py", line 87, in try_get_word_basics
    isChineseOrNot = self.dictionary._get_word(word[0],"simp")
IndexError: string index out of range
kris-w-stkd commented 2 years ago

I think this happens when you dont have any existing chinese words in your card datbase at all. It should handle this case better, will need a pr.

camerooncameroon commented 2 years ago
Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.49 (dc80804a) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2021-11-06 00:01:42

Caught exception:
Traceback (most recent call last):
  File "C:\Users\Asus\AppData\Roaming\Anki2\addons21\2121493325\mr_async_worker_thread.py", line 60, in run
    self.new_char_words, self.new_words, self.new_chars, self.printSummary = sc.scan_and_print(self.file_to_scan, self.file_or_dir, self.input_encoding, self.scan_mode)
  File "C:\Users\Asus\AppData\Roaming\Anki2\addons21\2121493325\mr_text_scanner.py", line 295, in scan_and_print
    scanned_words, anki_words, left_diff, intersect, scanned_chars, anki_chars, char_diff, char_intersect = self.scan_and_compare(
  File "C:\Users\Asus\AppData\Roaming\Anki2\addons21\2121493325\mr_text_scanner.py", line 278, in scan_and_compare
    self.load_words_from_anki_notes()
  File "C:\Users\Asus\AppData\Roaming\Anki2\addons21\2121493325\mr_text_scanner.py", line 194, in load_words_from_anki_notes
    c.execute(query)
sqlite3.OperationalError: database is locked

Hello, above is error log after trying to scan the inserted Chinese text. Database is the main one, and consists of many cards including Chinese ones. I also disabled all the addons except for Chinese Scanner. Windows default codepage for non-Unicode programs is Chinese (PRC), no beta UTF-8 enabled