Skip to content

Commit

Permalink
Parse json from kernelspec being printed with warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmed-shariff committed Jul 24, 2023
1 parent 1baabc8 commit 9a682c7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions jupyter-kernelspec.el
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,17 @@ REFRESH."
(or (and (not refresh) (gethash host jupyter--kernelspecs))
(let ((specs
(plist-get
(let ((json (or (jupyter-command "kernelspec" "list"
(let* ((json-result (or (jupyter-command "kernelspec" "list"
"--json" "--log-level" "ERROR")
(error "\
Can't obtain kernelspecs from jupyter shell command"))))
Can't obtain kernelspecs from jupyter shell command")))
(_ (string-match "{.*}" json-result))
(json-start (car (match-data)))
(json-end (cadr (mathc-data)))
(json (substring json-result json-start json-end)))
(when (> json-start 0)
(warn "Getting kernelspec has warning(s):"
(substring json-result 0 json-start)))
(condition-case nil
(jupyter-read-plist-from-string json)
(error
Expand Down

0 comments on commit 9a682c7

Please sign in to comment.