millejoh / emacs-ipython-notebook

Jupyter notebook client in Emacs
http://millejoh.github.io/emacs-ipython-notebook/
GNU General Public License v3.0
1.47k stars 123 forks source link

ein:content-query-contents--error 404 #870

Closed LazerJesus closed 1 year ago

LazerJesus commented 1 year ago

Hi, I installed EIN on emacs@30, m1mac, ipython 8.11.0.

In an org file i have this snippet:

#+BEGIN_SRC ein-python :session localhost
  print("hello python world")
#+end_src

When i babel-execute the block i get a range of errors

ein: [error] ein:content-query-contents--error 404 file or directory '/.ein-python.ipynb' does not exist

or

[error] request--callback: peculiar error: 400
ein: [error] Renaming content Untitled1.ipynb failed (error http 400) Cannot rename file or directory '/Untitled1.ipynb'.

what springs to mind is that its looking for the notebook in /, but the notebooks are in ~/[workdingdir]/nbs/*.ipynb what shall i do?

dickmao commented 1 year ago

True. At some point jupyter disallowed hidden files, possibly around https://github.com/jupyter-server/jupyter_server/commit/877da10cd0d7ae45f8b1e385fa1f5a335e7adf1f

I made ob-ein-anonymous-path default to the unhidden "ob-%s.ipynb", thus ensuring a lawsuit when an unsuspecting user names a very important file "ob-%s.ipynb".

Thanks for reporting. EIN 's semblance of functionality hangs by a thread. Can't stop won't stop.

LazerJesus commented 1 year ago

I am sorry but this is not yet fixed. (yes i pulled changes and verified)

i run the above codeblock in [workdir]/workbook.org it asks me for a path, where i specify [workbook]/nbs/ this is my messages buffer:

Code block evaluation complete.
ein: [info] ein:jupyter-server--run: /opt/homebrew/bin/jupyter notebook --notebook-dir=~/valence/courses/fastai/nbs/ --no-browser
Code block evaluation complete (took 4.7s).
ein: [info] Login to http://127.0.0.1:8888 complete.
[error] request--callback: peculiar error: 404
ein: [error] ein:content-query-contents--error 404 file or directory '/.ein-python.ipynb' does not exist
Auto-saving...done

[workbook]/nbs/ now contains Untitled.ipynb and my codeblock is surrounded by

#+NAME: FBB9B3AC-5E06-4DFD-ABA9-C6CD1E614415
#+BEGIN_SRC ein-python :session localhost
  print("hello python world")
#+end_src

#+RESULTS: FBB9B3AC-5E06-4DFD-ABA9-C6CD1E614415

(same as before)

Untitled.ipynb

{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bb30a9e8-9ebb-4557-9886-4185147eaae3",
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "argv": [
    "/opt/homebrew/Cellar/jupyterlab/3.6.1/libexec/bin/python3.11",
    "-m",
    "ipykernel_launcher",
    "-f",
    "{connection_file}"
   ],
   "display_name": "Python 3 (ipykernel)",
   "env": null,
   "interrupt_mode": "signal",
   "language": "python",
   "metadata": {
    "debugger": true
   },
   "name": "python3"
  },
  "name": "Untitled.ipynb"
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
LazerJesus commented 1 year ago

i would love to run jupyter cells of remote notebooks from within org. thats pretty much the dream setup for me atm. so lets fix this @dickmao, what can i do? i am here for about 2 more hours.

dickmao commented 1 year ago

If C-h v ob-ein-anonymous-path still says ".%s.ipynb", you're still running the old version.

Incidentally, you'll need ":results output" in your BEGIN_SRC.

LazerJesus commented 1 year ago

what function is bound to C-h v on your end? i have C-h mapped to some navigation in org mode

re:me i have Helpful mapped to something other than C-h... makes sense now.

LazerJesus commented 1 year ago

ok its working now. i had to restart emacs in its entirety, not just all the things i did before. cest la vie. lovely