From 49c824db167e35024a2d25363ac1e9a054f210bd 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 f4e4696f..e401951f 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