gregsexton / ob-ipython

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

Log message if jupyter not found instead of json-readtable-error #156

Open jjlee opened 6 years ago

jjlee commented 6 years ago

To reproduce (from emacs -Q):

Expect: No error

Got: File mode specification error: (json-readtable-error 47)

This makes ob-ipython message rather than fail with a json-readtable-error (whose origin and cause are not so obvious) if auto-configuring jupyter kernels fails because (for example) jupyter is not installed. The message includes both the shell command and the output of that command.

Related to #135 -- I don't think I could say it fixes it because I'm not sure that's a single issue, more of a self-help thread maybe...

The reason I personally want this is that it prevents issues like this, which occur even when the user isn't intending to use ob-ipython at all: https://github.com/syl20bnr/spacemacs/issues/9941

nanounanue commented 6 years ago

I just tested, and It still fails with:

executing Ipython code block...
json-read: JSON readtable error

This is from *Messages* buffer

dcherian commented 6 years ago

@nanounanue #135 definitely has multiple causes. This seems to fix only one of them.

jjlee commented 5 years ago

@dcherian As far as I can tell, all the other cases of json-readtable-error involve using ob-ipython. This particular case happens even if you're not really using ob-ipython, or indeed anything related to python at all, except by virtue of it happening to be loaded. For example, it happens in spacemacs when you load an empty .org file when you have both the python and org layers enabled.

Is it strictly relevant to this github issue that json-readtable-error happens in multiple places? Incidentally, the other cases presumably involve ob-ipython--collect-json to read JSON from a buffer while actually using ob-ipython, this one involves JSON read from shell-command-to-string when you use org. So I think they're fairly distinct issues.

Is there a reason not to merge this?

Can I help get it merged somehow?

I should say, I personally have used ob-ipython and think it's great, and I think it would be nice if random bystanders aren't in danger of being hit by this bug and learn to dislike the library as a repeating nuisance that makes them google and install some software (jupyter) to keep it happy :-(

jjlee commented 5 years ago

@nanounanue Exactly what did you test? (I expect you tested a different bug: for example, a bug discussed in #135 maybe?)

jjlee commented 5 years ago

I've updated the description to add steps to reproduce.

jjlee commented 5 years ago

Note the reason https://github.com/syl20bnr/spacemacs/issues/9941 is closed is that this upstream bug exists.