fonol / anki-search-inside-add-card

An add-on providing full-text-search and PDF reading functionality to Anki's Add card dialog
https://ankiweb.net/shared/info/1781298089
GNU Affero General Public License v3.0
178 stars 24 forks source link

user_files not automatically created #136

Closed ShaddyDC closed 4 years ago

ShaddyDC commented 4 years ago

Hello, I recently updated the addon after not having used anki on my desktop in a while. However, when launching anki, I was now greeted with this error:

Debug info:
Anki 2.1.26 (arch-linux-2.1.26-1) Python 3.8.5 Qt 5.15.0 PyQt 5.15.0
Platform: Linux
Flags: frz=False ao=True sv=2
Add-ons, last update check: 2020-09-23 01:01:02
Add-ons possibly involved: ⁨Searching PDF Reading  Note-Taking in Add Dialog⁩

Caught exception:
Traceback (most recent call last):
  File "/home/space/.local/share/Anki2/addons21/1781298089/src/index/indexing.py", line 238, in run
    self.t(*self.args)
  File "/home/space/.local/share/Anki2/addons21/1781298089/src/index/indexing.py", line 104, in _build_index
    index                               = FTSIndex(corpus, index_up_to_date)
  File "/home/space/.local/share/Anki2/addons21/1781298089/src/index/fts_index.py", line 81, in __init__
    conn = sqlite3.connect(self.dir + "search-data.db")
sqlite3.OperationalError: unable to open database file

If I ignored it and went to the Add window, I saw the addon stuck at "Preparing index..." with increased processor usage. I didn't let it run for an extended period of time, but it didn't finish within a couple of minutes. If I tried to open the addon's settings menu from here, I got the following error:

Debug info:
Anki 2.1.26 (arch-linux-2.1.26-1) Python 3.8.5 Qt 5.15.0 PyQt 5.15.0
Platform: Linux
Flags: frz=False ao=True sv=2
Add-ons, last update check: 2020-09-23 01:01:02
Add-ons possibly involved: ⁨Searching PDF Reading  Note-Taking in Add Dialog⁩

Caught exception:
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/aqt/webview.py", line 34, in cmd
    return json.dumps(self.onCmd(str))
  File "/usr/lib/python3.8/site-packages/aqt/webview.py", line 114, in _onCmd
    return self._onBridgeCmd(str)
  File "/usr/lib/python3.8/site-packages/aqt/webview.py", line 512, in _onBridgeCmd
    handled, result = gui_hooks.webview_did_receive_js_message(
  File "/usr/lib/python3.8/site-packages/aqt/gui_hooks.py", line 2091, in __call__
    handled = filter(handled, message, context)
  File "/home/space/.local/share/Anki2/addons21/1781298089/src/command_parsing.py", line 880, in expanded_on_bridge_cmd
    show_settings_modal(self)
  File "/home/space/.local/share/Anki2/addons21/1781298089/src/internals.py", line 44, in _eval_js_dec
    w.editor.web.eval(fn(*args, **kwargs))
  File "/home/space/.local/share/Anki2/addons21/1781298089/src/web/web.py", line 299, in show_settings_modal
    index.ui.showInModal(html)
AttributeError: 'NoneType' object has no attribute 'ui'

I was able to fix both by manually creating the user_files directory.

fonol commented 4 years ago

Hi, a similar error has been popping up recently for some users (although yours is a bit different). I think I might have a solution for that with one of the next updates.