Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize data dir #29

Merged
merged 1 commit into from
Aug 11, 2024
Merged

Conversation

uncomputable
Copy link
Contributor

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

The database cannot be initialized if the data dir does not exist.
@uncomputable
Copy link
Contributor Author

I completely forgot about this PR; thanks for approving it. Looks like the changes are still relevant for master.

@jamesmaa jamesmaa merged commit d292c80 into themoeway:master Aug 11, 2024
@uncomputable uncomputable deleted the init-data-dir branch August 12, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants