This repository has been archived by the owner on Dec 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 221
deleteDecks raises Exception(response["error"]) : rem() takes 2 positional arguments but 3 were given #286
Comments
sosie-js
changed the title
def deleteDecks(self, decks, cardsToo=False):
deleteDecks raises Exception(response["error"]) : rem() takes 2 positional arguments but 3 were given
Aug 31, 2021
Calling deleteDecks with javascript as it is on the example with cardssToo: true still doesnt remove the deck. Im going to try to fix this issue soon since I need this fucntion to be working for my project. |
I've been working on fixing the tests, for now i changed this anki-connect/plugin/__init__.py Lines 532 to 541 in 54a7105
to say @util.api()
def deleteDecks(self, decks, cardsToo=False):
if not cardsToo:
# since f592672fa952260655881a75a2e3c921b2e23857 (2.1.28)
# (see anki$ git log "-Gassert cardsToo")
# you can't delete decks without deleting cards as well.
# however, since 62c23c6816adf912776b9378c008a52bb50b2e8d (2.1.45)
# passing cardsToo to `rem` (long deprecated) won't raise an error!
# this is dangerous, so let's raise our own exception
if self._anki21_version >= 28:
raise Exception("Since Anki 2.1.28 it's not possible "
"to delete decks without deleting cards as well")
try:
self.startEditing()
decks = filter(lambda d: d in self.deckNames(), decks)
for deck in decks:
did = self.decks().id(deck)
self.decks().rem(did, cardsToo=cardsToo)
finally:
self.stopEditing() |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Konnitchiwa,
When using Ankisync2 deleteDecks sample from the readme or from the site
result = invoke("deleteDecks", decks=decks , cardsToo=cardsToo)
it is impossible to delete any deck., it raises Exception(response["error"])
Exception: rem() takes 2 positional arguments but 3 were given
Problem is, I guess it does not match the definition of api function declared ini.py
def deleteDecks(self, decks, cardsToo=False):
as cardsToo initialisation seems to interfers, maybe the same issue with 272
It crashes the ankisync2_web.py script, part of ankisync2 with ExamplesDoc Auto-Generator extension
The text was updated successfully, but these errors were encountered: