diff --git a/jupyter-kernelspec.el b/jupyter-kernelspec.el index e8219176..d66aac0c 100644 --- a/jupyter-kernelspec.el +++ b/jupyter-kernelspec.el @@ -103,8 +103,10 @@ REFRESH." (or (and (not refresh) (jupyter-kernelspecs-cache-get host)) (let ((specs (plist-get - (let ((json (or (jupyter-command "kernelspec" "list" - "--json" "--log-level" "ERROR") + (let ((json (or (let* ((jupyter-output (jupyter-command "kernelspec" "list" + "--json" "--log-level" "ERROR")) + (json-start (string-match-p (rx line-start "{") jupyter-output))) + (and json-start (substring jupyter-output json-start))) (error "\ Can't obtain kernelspecs from jupyter shell command")))) (condition-case nil