themoeway / local-audio-yomichan

Anki add-on to run a local audio server for Yomichan.
MIT License
73 stars 10 forks source link

Initialize data dir #29

Open uncomputable opened 2 months ago

uncomputable commented 2 months ago

The database cannot not be initialized if the data dir doesn't exist. This happened to me on Linux, running the server outside of Anki.

python run_server.py 
/home/user/.local/share/local-audio-yomichan/entries.db
Traceback (most recent call last):
  File "/home/user/Documents/japanese/local-audio-yomichan/run_server.py", line 12, in <module>
    attempt_init_db()
  File "/home/user/Documents/japanese/local-audio-yomichan/plugin/db_utils.py", line 182, in attempt_init_db
    if not table_exists_and_has_data():
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/Documents/japanese/local-audio-yomichan/plugin/db_utils.py", line 124, in table_exists_and_has_data
    with sqlite3.connect(get_db_file()) as conn:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: unable to open database file