Skip to content

Commit 9a682c7

Browse files
committed
Parse json from kernelspec being printed with warnings
1 parent 1baabc8 commit 9a682c7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

jupyter-kernelspec.el

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,17 @@ REFRESH."
7676
(or (and (not refresh) (gethash host jupyter--kernelspecs))
7777
(let ((specs
7878
(plist-get
79-
(let ((json (or (jupyter-command "kernelspec" "list"
79+
(let* ((json-result (or (jupyter-command "kernelspec" "list"
8080
"--json" "--log-level" "ERROR")
8181
(error "\
82-
Can't obtain kernelspecs from jupyter shell command"))))
82+
Can't obtain kernelspecs from jupyter shell command")))
83+
(_ (string-match "{.*}" json-result))
84+
(json-start (car (match-data)))
85+
(json-end (cadr (mathc-data)))
86+
(json (substring json-result json-start json-end)))
87+
(when (> json-start 0)
88+
(warn "Getting kernelspec has warning(s):"
89+
(substring json-result 0 json-start)))
8390
(condition-case nil
8491
(jupyter-read-plist-from-string json)
8592
(error

0 commit comments

Comments
 (0)