From 2b5eaec7e9b6e60870d2c6f9259d0c210cc0bc67 Mon Sep 17 00:00:00 2001 From: "Yuri D. Lensky" Date: Sun, 27 Nov 2022 11:36:57 -0500 Subject: [PATCH] Skip headers from jupyter kernelspec list. --- jupyter-kernelspec.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jupyter-kernelspec.el b/jupyter-kernelspec.el index b87334a6..9af36187 100644 --- a/jupyter-kernelspec.el +++ b/jupyter-kernelspec.el @@ -76,8 +76,10 @@ REFRESH." (or (and (not refresh) (gethash host jupyter--kernelspecs)) (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