Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running anki throws a json-readtable-error #9

Closed
hiorig opened this issue Sep 6, 2021 · 4 comments
Closed

Running anki throws a json-readtable-error #9

hiorig opened this issue Sep 6, 2021 · 4 comments

Comments

@hiorig
Copy link

hiorig commented Sep 6, 2021

GNU Emacs 27.2-1
Arch Linux

(use-package anki
  :straight (anki :type git :host github :repo "chenyanming/anki.el")
  :init
  (add-hook 'anki-mode-hook #'shrface-mode)
  (add-hook 'anki-card-mode-hook #'shrface-mode)
  (autoload 'anki "anki")
  (autoload 'anki-browser "anki")
  (autoload 'anki-list-decks "anki")
  :config
  (setq anki-shr-rendering-functions (append anki-shr-rendering-functions shr-external-rendering-functions))
  (setq sql-sqlite-program "/usr/bin/sqlite3")
  (setq anki-collection-dir "/home/jonny/.local/share/Anki2/Usuário 1"))

After running M-x Anki or M-x Anki-Browser it gives the error Debugger entered--Lisp error: (json-readtable-error 99)

emacs -debug-init

Debugger entered--Lisp error: (json-readtable-error 99)
  signal(json-readtable-error (99))
  json-read()
  json-read-from-string("cp: overwrite '/tmp/collection.anki2'? \2")
  (let* ((json-array-type 'list) (json-object-type 'hash-table) (json-false nil)) (json-read-from-string (anki-core-query anki-core-query-models)))
  (let ((models (let* ((json-array-type 'list) (json-object-type 'hash-table) (json-false nil)) (json-read-from-string (anki-core-query anki-core-query-models))))) (setq anki-core-models-hash-table models) models)
  anki-core-parse-models()
  (let* ((query-result (anki-core-query anki-core-query-cards)) (lines (if query-result (split-string query-result anki-core-sql-newline)))) (anki-core-parse-models) (anki-core-parse-decks) (cond ((equal "" query-result) '("")) (t (let* ((--cl-var-- lines) (line nil) (--cl-var-- nil)) (while (consp --cl-var--) (setq line (car --cl-var--)) (if (not (equal line "")) (progn (setq --cl-var-- ...))) (setq --cl-var-- (cdr --cl-var--))) (nreverse --cl-var--)))))
  anki-core-parse-cards()
  (let* ((--cl-var-- (anki-core-parse-cards)) (card nil)) (while (consp --cl-var--) (setq card (car --cl-var--)) (if (hash-table-p card) (progn (let ((id (gethash ... card))) (puthash 'card-format (anki-core-format-card-hash-table card) card) (setq anki-core-database-index (cons id anki-core-database-index)) (puthash id card cards)))) (setq --cl-var-- (cdr --cl-var--))) nil)
  (let ((cards (make-hash-table :test 'equal))) (let* ((--cl-var-- (anki-core-parse-cards)) (card nil)) (while (consp --cl-var--) (setq card (car --cl-var--)) (if (hash-table-p card) (progn (let ((id ...)) (puthash 'card-format (anki-core-format-card-hash-table card) card) (setq anki-core-database-index (cons id anki-core-database-index)) (puthash id card cards)))) (setq --cl-var-- (cdr --cl-var--))) nil) (setq anki-core-hash-table cards) cards)
  anki-core-cards()
  (hash-table-values (anki-core-cards))
  anki-core-cards-list()
  (setq anki-search-entries (anki-core-cards-list))
  (progn (setq anki-search-entries (anki-core-cards-list)) (setq anki-full-entries anki-search-entries))
  (if anki-search-entries anki-search-entries (progn (setq anki-search-entries (anki-core-cards-list)) (setq anki-full-entries anki-search-entries)))
  anki()
  funcall-interactively(anki)
  call-interactively(anki record nil)
  command-execute(anki record)
  counsel-M-x-action("anki")
  ivy-call()
  ivy-read("M-x " [eww-buffer-select Post\ Handshake\ Auth ansi-color-apply-overlay-face epg-context-signers locals 0 --cl-block-eaf-deferred-object-errorback--cmacro-- vc-git-stash-snapshot denied custom-face-menu pdf-cache-renderpage-highlight pdf-cache-pagelinks bbdb-current-record duplicate olp mml-secure-smime-sign-with-sender url-cookie-multiple-line url-scheme-registry no-activate vc-src-log-switches prequery mixal gnus-summary-recenter avl-tree--stack-store--cmacro bibtex-reformat-previous-reference-keys which-key-side-window-max-height org-fragtog-ignore-predicates :examined org-agenda-regexp-filter-preset vc-git-conflicted-files edited-forwarded-messages IBM\ Plex\ Sans\ Condensed semanticdb-project-database-file-child-p shr-parse-image-data \" line-num message-kill-actions nnheader-translate-file-chars package-menu--new-package-list vc-bzr-shelve ---5 gnus-summary-catchup-from-here :start-time ---8 sessions dont-create calc-embedded-mode-hook define-mode-local-override mu4e-view-image-max-height doc-view-pdf/ps->png ...] :predicate #f(compiled-function (sym) #<bytecode 0x157af2c92721>) :require-match t :history counsel-M-x-history :action counsel-M-x-action :keymap (keymap (67108908 . counsel--info-lookup-symbol) (67108910 . counsel-find-symbol)) :initial-input nil :caller counsel-M-x)
  counsel-M-x()
  funcall-interactively(counsel-M-x)
  call-interactively(counsel-M-x nil nil)
  command-execute(counsel-M-x)
@chenyanming
Copy link
Owner

Check #2

@hiorig
Copy link
Author

hiorig commented Sep 7, 2021

I tried selecting the option to Downgrade and Quit in Anki 2.1.35-3 and tried to downgrade Anki to version 2.1.15.
Both gave me the same error json-readtable-error (99).

@chenyanming
Copy link
Owner

chenyanming commented Sep 7, 2021

Would you try to

(setq debug-on-error t)

and give me the debug result?

@hiorig
Copy link
Author

hiorig commented Sep 7, 2021

The error was the same in both cases as the first post.
I had an alias on my config file "cp = cp -iv", so using anki-core-query was returning the confirmation to overwrite the collection.anki instead of the card's json.
Without this alias the program works perfectly.

@hiorig hiorig closed this as completed Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants