dfeich / org-babel-examples

Examples using emacs org mode babel inline source code with different backend languages
569 stars 116 forks source link

error in process sentinel #9

Open JonatanSahar opened 6 months ago

JonatanSahar commented 6 months ago

Hi! I'm getting:

Executing Ipython code block at position 109... Code block evaluation complete. error in process sentinel: cons: JSON readtable error: 47 error in process sentinel: JSON readtable error: 47

when trying to run a simple code block with ipython.

I have

#+PROPERTY: header-args:ipython :session py-1 as a header.

dfeich commented 6 months ago

Hi this could be a problem with your python emacs configuration..

But it also could be that you are using "ipython" as a header arg. Usually the babel language is "python", and you can set the interactive session shell to be ipython. This usually is done in your configuration where the "python-shell-interpreter" variable gets set to ipython to provide a nicer REPL.

Other ideas: You could try to have a look at the buffer "py-1" that should have been started in emacs for the session. Emacs executes the commands there and then reads/parses the output back (and that is where the sentinel comes into play. It's the mechanism by which emacs checks for changes in the session buffer). If the session buffer does not exist, it probably already fails when trying to start your ipython session.

When you are in the org buffer from which you execute, check from where it gets the executable it by doing in the buffer

M-s ! which ipython

This is at least how I would start to debug the thing.

JonatanSahar commented 6 months ago

Thanks for looking into it! I have been setting my header to ipython.. Having changed it I'm getting a fatal error from ob-ipython, with the following in the debug buffer (sorry for all the formatting garbage):

--------------------------------------------------------------------------- OSError Traceback (most recent call last) File ~/.config/emacs/.local/straight/repos/ob-ipython/client.py:60  57 parser.add_argument('--complete', action='store_true')  58 args = parser.parse_args() ---> 60 c = create_client(args.conn_file)  62 with interested_lock:  63 if args.execute:

File ~/.config/emacs/.local/straight/repos/ob-ipython/client.py:43, in create_client(name)  41 cf = find_connection_file(name)  42 else: ---> 43 cf = find_connection_file('emacs-' + name)  44 c = client.BlockingKernelClient(connection_file=cf)  45 c.load_connection_file()

File ~/miniforge3/lib/python3.10/site-packages/jupyter_client/connect.py:233, in find_connection_file(filename, path, profile)  231 if not matches:  232 msg = f"Could not find {filename!r} in {path!r}" --> 233 raise OSError(msg)  234 elif len(matches) == 1:  235 return matches[0]

OSError: Could not find 'emacs-none' in ['.', '/home/yonatan/.local/share/jupyter/runtime']

Looks like it can't find a kernel to connect to? I've tried setting ob-ipython-command to ipython instead of jupyter but that didn't help..