Unable to `sync_login` via `anki` Python pkg to AnkiWeb

Thanks for everything that is Anki, it powers my learning, such a great project!

I’m trying to run a programmatic sync but stumbling into issues, snippet below has been tried with 24.4 & 23.12.1 both on Linux & Mac:

from anki.collection import Collection
col = Collection("path/to/prefs.db")                            
auth = col.sync_login("username", "password", None)

It errors out (only in the case where valid credentials are provided):

blocked main thread for 309ms:
  File "<stdin>", line 1, in <module>
  File "/home/luca/miniconda3/lib/python3.12/site-packages/anki/collection.py", line 1106, in sync_login
    return self._backend.sync_login(
  File "/home/luca/miniconda3/lib/python3.12/site-packages/anki/_backend_generated.py", line 83, in sync_login
    raw_bytes = self._run_command(1, 3, message.SerializeToString())
  File "/home/luca/miniconda3/lib/python3.12/site-packages/anki/_backend.py", line 169, in _run_command

Any ideas? If there’s any more info I could provide let me know.

It’s a warning that you’re running the action on the main thread, not an error.

:sweat_smile: - completely missed that, thanks!