tkf / emacs-ipython-notebook

IPython notebook client in Emacs
tkf.github.com/emacs-ipython-notebook/
GNU General Public License v3.0
548 stars 51 forks source link

Auto create notebook and connect #132

Open rrod497 opened 10 years ago

rrod497 commented 10 years ago

Hi,

Everytime I open emacs for python coding, I have to:

I am trying to find a way to do it all at once and auto. So far, I wrote:

(setq-default ein:use-auto-complete-superpack t ein:worksheet-enable-undo 'full) (add-hook 'ein:connect-mode-hook 'ein:jedi-setup)

(setq my-python-first-start-p t) (defun my-python-ein-initialize () (interactive) (if my-python-first-start-p (progn (async-shell-command "ipython notebook --pylab=inline") (setq-default ein:default-url-or-port 8888) (ein:notebooklist-load) (setq my-python-first-start-p nil)) nil) (setq-local ein:connect-default-notebook (concat (number-to-string ein:default-url-or-port) "/" (file-name-base))))

(defun my-python-ein-connect () (interactive) (ein:notebooklist-new-notebook-with-name (file-name-base) ein:default-url-or-port) (ein:connect-to-default-notebook))

But i get some errors on that. Firstly, I call my-python-ein-initialize interactively from inside of a python file named passwordGtk, and I get the messages:

Contacting host: 127.0.0.1:8888 error in process filter: buffer-name: Symbol's value as variable is void: windw error in process filter: Symbol's value as variable is void: windw ein: [info] Opened notebook list at 8888

I got, succesfully, an open buffer named ein:notebooklist 8888 without any notebook. Moreover, I get an epc con 3 empty buffer and an Asyn Shell Command running the ipython notebook process. My browser so pop up with the IPython notebook page and I have to Alt-tab back to emacs.

So, i call my-python-ein-connect interactively from the same file, and get:

Contacting host: 127.0.0.1:8888 ein: [info] Opened notebook list at 8888 user-error: Minibuffer window is not active ein: [info] Creating a new notebook... Contacting host: 127.0.0.1:8888 ein: [info] Notebook '8888/passwordGtk' not found error in process filter: buffer-name: Symbol's value as variable is void: windw error in process filter: Symbol's value as variable is void: windw ein: [info] Creating a new notebook... Done. ein: [info] Opening notebook 107df057-3834-442e-8b6b-e7363697d6e2... ein: [info] Worksheet Untitled0 is ready ein: [info] Notebook Untitled0 is ready error in process filter: buffer-name: Symbol's value as variable is void: windw error in process filter: Symbol's value as variable is void: windw ein: [info] Kernel started: 5834bbf3-0683-493e-b6be-2671307c17c8 ein: [info] Starting WS: "ws://127.0.0.1:8888/kernels/5834bbf3-0683-493e-b6be-2671307c17c8" ein: [info] Opened notebook list at 8888 ein: [info] Notebook is saved. error in process filter: buffer-name: Symbol's value as variable is void: windw error in process filter: Symbol's value as variable is void: windw ein: [info] Opened notebook list at 8888 error in process filter: buffer-name: Symbol's value as variable is void: windw error in process filter: Symbol's value as variable is void: windw error in process filter: buffer-name: Symbol's value as variable is void: windw error in process filter: Symbol's value as variable is void: windw error in process filter: buffer-name: Symbol's value as variable is void: windw error in process filter: Symbol's value as variable is void: windw

After that, I got a functional ein: 888/passwordGtk notebook buffer. Its entry on the notebooklist buffer is visible and ok, but my file isn't connected to the notebook.

Finally, if I call again the function my-python-ein-connect, the result is as follow:

ein: [info] Creating a new notebook... Contacting host: 127.0.0.1:8888 ein: [info] Notebook passwordGtk is already opened. ein: [info] Connected to passwordGtk ein: [info] Creating a new notebook... Done. ein: [info] Opening notebook 09d8e5fb-2dbb-4a90-8722-8808788f15eb... ein: [info] Opened notebook list at 8888 ein: [info] Worksheet Untitled0 is ready ein: [info] Notebook Untitled0 is ready error in process filter: buffer-name: Symbol's value as variable is void: windw error in process filter: Symbol's value as variable is void: windw ein: [info] Notebook is saved. ein: [info] Kernel started: 213ffb69-4d42-4366-b692-5e0fbd3cf23a ein: [info] Starting WS: "ws://127.0.0.1:8888/kernels/213ffb69-4d42-4366-b692-5e0fbd3cf23a" error in process filter: buffer-name: Symbol's value as variable is void: windw error in process filter: Symbol's value as variable is void: windw error in process filter: buffer-name: Symbol's value as variable is void: windw error in process filter: Symbol's value as variable is void: windw error in process filter: buffer-name: Symbol's value as variable is void: windw error in process filter: Symbol's value as variable is void: windw error in process filter: buffer-name: Symbol's value as variable is void: windw error in process filter: Symbol's value as variable is void: windw error in process filter: buffer-name: Symbol's value as variable is void: windw error in process filter: Symbol's value as variable is void: windw REQUEST [error] Callback is not called when stopping process! Explicitly calling from timer. ein: [error] Error (timeout) while opening notebook list at the server 8888. Buffer " http 127.0.0.1:8888-385543" has a running process; kill it? (y or n) n ein: [error] Error (timeout) while opening notebook list at the server 8888.

Then my file is actually connected to the notebook. But Now I have another notebook: ein: 888/passwordGtk<2>. My notebooklist buffer now shows the previous passwordGtk notebook plus a new one named Untitled0. If I reload the list, it disappears from the list.

There are so many strange behaviors in this process and I am not an experienced lisp programmer. Can you help me or clarify some of those cryptic error outputs?