Skip to content

Commit

Permalink
Don't error if jupyter not found while auto-configuring kernels
Browse files Browse the repository at this point in the history
  • Loading branch information
jjlee authored and DuCorey committed Jan 18, 2019
1 parent c4e439a commit 202c092
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions ob-ipython.el
Original file line number Diff line number Diff line change
Expand Up @@ -521,17 +521,24 @@ a new kernel will be started."
"Return a list of available jupyter kernels and their corresponding languages.
The elements of the list have the form (\"kernel\" \"language\")."
(and ob-ipython-command
(let ((kernelspecs (cdar (json-read-from-string
(shell-command-to-string
(s-concat ob-ipython-command " kernelspec list --json"))))))
(-map (lambda (spec)
(cons (symbol-name (car spec))
(->> (cdr spec)
(assoc 'spec)
cdr
(assoc 'language)
cdr)))
kernelspecs))))
(let*
((kernelspecs-cmd (s-concat ob-ipython-command " kernelspec list --json"))
(kernelspecs-text (shell-command-to-string kernelspecs-cmd))
(kernelspecs
(condition-case-unless-debug nil
(cdar (json-read-from-string kernelspecs-text))
(json-readtable-error
(message "Failed to list jupyter kernels with: %s" kernelspecs-cmd)
nil))))
(when kernelspecs
(-map (lambda (spec)
(cons (symbol-name (car spec))
(->> (cdr spec)
(assoc 'spec)
cdr
(assoc 'language)
cdr)))
kernelspecs)))))

(defun ob-ipython--configure-kernel (kernel-lang)
"Configure org mode to use specified kernel."
Expand Down

0 comments on commit 202c092

Please sign in to comment.