langfield / ki

version control for Anki collections
https://langfield.github.io/ki/
GNU Affero General Public License v3.0
70 stars 3 forks source link

Repost: AnkiAlreadyOpenError: fatal: Anki already open, or media currently syncing #165

Closed 01nterrupt closed 8 months ago

01nterrupt commented 8 months ago

Hi @langfield, sorry for the repost. I was having trouble with my previous GitHub account, and not sure if you're able to see that issue (I think #160?) so reposting.

This looks super promising for a project I'm working on, creating some decks Going through the steps from "Getting started", the clone seemed to work. I edited, git-added/-committed a change. But when I try to ki push, get the following spewage: raise AnkiAlreadyOpenError(str(err)) from err ki.types.AnkiAlreadyOpenError: fatal: Anki already open, or media currently syncing.

(full error and script transcript attached)

Anki definitely wasn't running, as is demonstrated with the pgrep and lsof commands. I've tried this twice, after rebooting, same result Using macOS Sonoma 14.0 (23A344)

I don't actually use Anki, so maybe there is something wrong with my installation, or the deck that is installed that I had cloned? (I don't even remember installing that deck, and was surprised to even have it (and Anki) already on my computer. Perhaps reinstalling Anki should be my next step?

I deleted Anki from my system, including the entire directory under ~/Library/Application\ Support/Anki2 Then I followed the Installation instructions here: https://github.com/langfield/A2_Wortliste_Goethe Everything worked as expected until the final line: ki push. Same error as above.

I'd really like to get this working, as seems like a great approach for Anki deck management. So any advice would be appreciated. Thank you! ki.spewage.txt

langfield commented 8 months ago

Hi! 😁 Thanks for trying out this program.

I've taken a look at the stack trace, and I see what is happening. It should be a quick fix, I will update here once I've verified it. In the meantime, would mind trying to run the tests with make test (after cloning the repo). I am curious if they break as well.

01nterrupt commented 8 months ago

That's great news! Thanks for taking a look. Attached are test results.

ki_test_results.txt

langfield commented 8 months ago

Okay, try reinstalling on this branch:

python3 -m pip install git+https://github.com/langfield/ki.git@fix-database-lock-handling

I've pushed a candidate fix. πŸ™‚

01nterrupt commented 8 months ago

Wow, that apparently did the trick! I'm not yet familiar with Anki to validate the result, but this unblocks me, and I'll proceed with my project using ki.

brian@MacBrian-Pro collection % ki push             
/Users/brian/Documents/Projects/kitest/collection
Notes: : 0it [00:00, ?it/s]
Media: : 0it [00:00, ?it/s]
Notes: : 0it [00:00, ?it/s]
Notetypes: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00, 3379.78it/s]
ki push: up to date.

Attached is the updated test result

ki_test_results2.txt

tl;dr: was: 35 failed, 118 passed, 1 warning in 22.38s now: 13 failed, 138 passed, 1 skipped, 1 xfailed in 26.29s

langfield commented 8 months ago

Very glad it's working for you! ❀️ If you have the time, I have pushed a fix for the remainder of the broken tests, and I'd love to see if they all pass on your machine now. (Try reinstalling with that same command above). I have the CI setup to run on macOS but for whatever reason I'm not able to reproduce the failures. 😒

01nterrupt commented 8 months ago

Big improvement! (results attached)

ki_test_results3.txt

1 failed, 150 passed, 1 skipped, 1 xfailed in 28.48s

Note that I'm using system python (via Xcode tools), which apparently isn't the recommended configuration. I'm willing to change that if you have a recommendation.

langfield commented 8 months ago

Wonderful, that was really helpful! 😁 Yeah that last one is probably something I can't debug very well by proxy, hahah. Please do let me know how your project works out! Feel free to open an issue of the form "Progress with X" or something, if you'd like to chat!

01nterrupt commented 8 months ago

I'll keep you posted. Thanks again!