Skip to content

Commit e548c6c

Browse files
committed
jupyter-available-kernelspecs: Handle parsing kernelspecs better
Raise an error when `jupyter kernelspec list --json` doesn't return valid JSON.
1 parent 11ace8c commit e548c6c

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

jupyter-kernelspec.el

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,20 @@ REFRESH."
7676
(or (and (not refresh) (gethash host jupyter--kernelspecs))
7777
(let ((specs
7878
(plist-get
79-
(jupyter-read-plist-from-string
80-
(or (jupyter-command "kernelspec" "list" "--json" "--log-level" "ERROR")
81-
(error "Can't obtain kernelspecs from jupyter shell command")))
79+
(let ((json (or (jupyter-command "kernelspec" "list"
80+
"--json" "--log-level" "ERROR")
81+
(error "\
82+
Can't obtain kernelspecs from jupyter shell command"))))
83+
(condition-case nil
84+
(jupyter-read-plist-from-string json)
85+
(error
86+
(error "\
87+
Jupyter kernelspecs couldn't be parsed from
88+
89+
jupyter kernelspec list --json
90+
91+
To investiagate further, run that command in a shell and examine
92+
why it isn't returning valid JSON."))))
8293
:kernelspecs)))
8394
(puthash
8495
host

0 commit comments

Comments
 (0)