gregsexton / ob-ipython

org-babel integration with Jupyter for evaluation of (Python by default) code blocks
737 stars 111 forks source link

"wrong type arguments: stringp sh" #203

Open cheremin opened 5 years ago

cheremin commented 5 years ago

I'm using ob-ipython-20180224.953, and I've seen this error ("wrong type arguments: stringp sh") while doing something completely unrelated to ipython. I've traced it, and it ends up in the following code:

(defun ob-ipython--configure-kernel (kernel-lang)
  "Configure org mode to use specified kernel."
  (let* ((kernel (car kernel-lang))
         (language (cdr kernel-lang))
         (jupyter-lang (concat "jupyter-" language))
         (mode (intern (or  (cdr (assoc language org-src-lang-modes))
                           (replace-regexp-in-string "[0-9]*" "" language))))
         (header-args (intern (concat "org-babel-default-header-args:" jupyter-lang))))
...

It seems like most kernel names are like "Julia-0.6", and not directly found in org-src-lang-modes, thus their names are going through (replace-regexp-in-string ...) branch. But in my case I has kernel "bash", installed in my jupyter, and this kernel name is as-is present in org-src-lang-modes. And here is the catch: this map contains languages as symbols not strings, but intern expect string, not symbol.

Personally, I've fixed it in my copy by just add (symbol-name ..) call around (cdr (assoc language org-src-lang-modes)). Probably, even better solution would be to move (intern ..) to be only around (replace-regexp-in-string ...), since it is not needed in first branch.

vv111y commented 5 years ago

same issue except instead of sh it is c++. The error prevents ediff-current-file from working for an orgmode buffer.

Your hack worked, thank you.

Further though, this package seems to be abandoned #202 , so I think I will remove it altogether in favour of emacs-jupyter