ankicommunity / ankicommunity-sync-server

A personal Anki sync server (so you can sync against your own server rather than AnkiWeb)
GNU Affero General Public License v3.0
870 stars 80 forks source link

anki desktop 2.1.41-42 Unable to start(*[], **{'minUsn': 0, 'lnewer': True, 'graves': None}): 'NoneType' object is not subscriptable #74

Open liu-hz opened 3 years ago

liu-hz commented 3 years ago

When I was testing the version of anki2.1.41, I encountered the following problem: "nonetype" object is not subsertable. how i can fix it ?

this is the error ,'graves' show None Running start(*[], **{'minUsn': 0, 'lnewer': True, 'graves': None})

Unable to start(*[], **{'minUsn': 0, 'lnewer': True, 'graves': None}): 'NoneType' object is not subscriptable

the right 'garves' like this ? Running begin(*[], **{'skey': '424f9c42'})

Forced synchronization can be executed. If you just click synchronization, an error will be reported. It is found that the last parameter graves in the parameter package after begin is set to none. Under normal circumstances,I’m not sure if this problem is caused by the new version enabling V2,"The offset para is passed by client V2 " Please master advice, how to deal with. be deeply grateful!

Traceback (most recent call last): File "/anki-sync-server/src/ankisyncd/thread.py", line 98, in _run ret = self.wrapper.execute(func, args, kw, return_queue) File "/anki-sync-server/src/ankisyncd/collection.py", line 45, in execute ret = func(args, kw) File "/anki-sync-server/src/ankisyncd/sync_app.py", line 579, in run_func res = handler_method(keyword_args) File "/anki-sync-server/src/ankisyncd/sync_app.py", line 124, in start self.remove(graves) File "/anki-sync-server/src/ankisyncd/sync.py", line 189, in remove self.col.remove_cards_and_orphaned_notes(graves['cards']) TypeError: 'NoneType' object is not subscriptable Traceback (most recent call last): File "/usr/lib/python3.8/wsgiref/handlers.py", line 137, in run self.result = application(self.environ, self.start_response) File "/usr/local/lib/python3.8/dist-packages/webob/dec.py", line 129, in call resp = self.call_func(req, args, kw) File "/usr/local/lib/python3.8/dist-packages/webob/dec.py", line 193, in call_func return self.func(req, *args, *kwargs) File "/anki-sync-server/src/ankisyncd/sync_app.py", line 523, in call result = self._execute_handler_method_in_thread(url, data, session) File "/anki-sync-server/src/ankisyncd/sync_app.py", line 588, in _execute_handler_method_in_thread result = thread.execute(run_func, kw=keyword_args) File "/anki-sync-server/src/ankisyncd/thread.py", line 79, in execute raise ret File "/anki-sync-server/src/ankisyncd/thread.py", line 98, in _run ret = self.wrapper.execute(func, args, kw, return_queue) File "/anki-sync-server/src/ankisyncd/collection.py", line 45, in execute ret = func(args, kw) File "/anki-sync-server/src/ankisyncd/sync_app.py", line 579, in run_func res = handler_method(**keyword_args) File "/anki-sync-server/src/ankisyncd/sync_app.py", line 124, in start self.remove(graves) File "/anki-sync-server/src/ankisyncd/sync.py", line 189, in remove self.col.remove_cards_and_orphaned_notes(graves['cards']) TypeError: 'NoneType' object is not subscriptable

liu-hz commented 3 years ago

I redone the server yesterday and upgrade Python to 3.9, but it still shows the same error.

liu-hz commented 3 years ago

def start(self, minUsn, lnewer, graves={"cards": [], "notes": [], "decks": []}, offset=None):
When the start method is executed, the graves value becomes none. If it is normal, a set of values should be passed in? I have been paying close attention to this problem. If there are users who encounter the same problem, please tell us how to solve it, or we have to wait for the service version to be updated. If you use version 2.1.41 or above is normal, can you help me to see where my problem , thank you very much, and look forward to solving the problem as soon as possible!

dobefore commented 3 years ago

83

genedan commented 3 years ago

I ran into the same problem using Anki 2.1.44, applying pull request #83 has worked for me.

VikashKothary commented 3 years ago

I've merged the PR. Please let me know if this resolves the problem and then close this issue.