Open peng051410 opened 5 years ago
Did you check your anki deck if the card got created? I'm getting the same error
:ANKI_FAILURE_REASON: Wrong type argument: listp, 1574183000426
, but the card still gets created.
I observe similar behaviour (successful creation of a card despite anki-editor reporting failure) using Emacs 26.3, anki-editor-20190922 and an install of Anki Connect as of today (2020-03-04). My *request-log*
contains the following:
HTTP/1.1 200 OK
Content-Type: text/json
Access-Control-Allow-Origin: http://localhost
Content-Length: 42
{"result": [1583362257365], "error": null}
[debug] request--callback: PARSED
((result 1583362257365) (error))
[debug] request--callback: executing success
For what it's worth: I had the same issue and solved it by the most recent version - meaning the one from here and not from MELPA.
revert to version 0.3.0, it was fixed. (: ANKI_NOTE_ID: has been added to the :PROPERTIES:, and the card registered from anki-editor can be updated.)
Im facing the same issue on 0.3.3, reverting to 0.3.0 fixes it.
my emacs: GNU Emacs 26.1 (build 2, arm-unknown-linux-gnueabihf, GTK+ Version 3.24.5) of 2021-02-06, modified by Debian
any ideas how to debug or fix the issue on 0.3.3 ?
AFAICT, the "result" from Anki is now a list instead of an atom, i.e., [1234] vs 1234
.
The error is caused by calling alist-get
when result is not an alist. I was able to fix it locally by editing the definition of anki-editor--anki-connect-invoke-multi to add an extra clause that checks whether (car result)
is also a list before treating it as an alist.
(defun anki-editor--anki-connect-invoke-multi (&rest actions)
(-zip-with (lambda (result handler)
(when-let ((_ (listp result))
(_ (listp (car result))) ;; <== ADD THIS
(err (alist-get 'error result)))
(error err))
(and handler (funcall handler result)))
(anki-editor--anki-connect-invoke-result
"multi" `((actions . ,(mapcar #'car actions))))
(mapcar #'cdr actions)))
I'd be happy to submit a pull request for this if the project is still maintained.
@astahlman nice one! That fixed it up for me here too
when i run
anki-editor-push-notes
i got this error: Wrong type argument: listp, 1564113163940anki version: 2.1.11