Support for python scripting while app is open

I’m trying to write a python script that reads data from my anki2 file. For example:

from anki.storage import Collection
print(len(Collection("some_path/collection.anki2").find_cards("is:due")))

This works when the Anki app is closed, but when it’s open I get this error: anki.errors.DBError: Anki already open, or media currently syncing.

It seems like the Anki app holds an exclusive lock on the database while it’s running. It would be nice if reading from the database worked while the app is open.

1 Like

This is unlikely to ever happen, as concurrent access precludes caching, and introduces a lot of extra complexity.