[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] session with python-mode.el complains of void py-toggle-shells
From: |
Nick Dokos |
Subject: |
Re: [O] session with python-mode.el complains of void py-toggle-shells |
Date: |
Tue, 22 Jan 2013 23:11:29 -0500 |
Myles English <address@hidden> wrote:
> Hi,
>
> I think it should be possible to execute a python block in a session
> using python-mode.el but get this message:
>
> "Symbol's function definition is void: py-toggle-shells"
>
> Using the latest git head and opening this file with:
>
> $ emacs -Q thisfile.org
>
> then executing these src blocks in order, shows the problem:
>
> #+BEGIN_SRC emacs-lisp
> (require 'org)
> (org-babel-do-load-languages
> 'org-babel-load-languages
> '((python . t)))
> #+END_SRC
>
> #+RESULTS:
> | (python . t) |
>
> * A heading
>
> This works okay:
>
> #+begin_src python :results output :session a
> import sys
> #+end_src
>
> #+RESULTS:
>
> Try with python3:
>
> #+begin_src elisp
> (setq org-babel-python-command "python3"
> py-python-command "python3"
> )
> #+end_src
>
> #+RESULTS:
> : python3
>
> works also:
>
> #+begin_src python :results output :session a
> import sys
> #+end_src
>
> #+RESULTS:
>
> Try using python-mode.el:
>
> #+begin_src elisp
> (setq org-babel-python-mode 'python-mode)
> (load-file "/usr/share/emacs/site-lisp/python-mode.el")
> #+end_src
>
> #+RESULTS:
> : t
>
> #+begin_src python :results output :session a
> import sys
> #+end_src
>
> Gives this *Message*:
>
> org-babel-python-initiate-session-by-key: Symbol's function definition
> is void: py-toggle-shells
>
> Do I need to configure something else?
>
I get in trouble much sooner than you do: when evaluating the first code
block. The error in my case was that run-python was called with the
wrong number of args (from the same function: it's a couple of lines
before py-toggle-shells is called). I'm running
GNU Emacs 24.3.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.4) of
2012-12-29
and run-python does indeed need a required arg in this version:
,----
| run-python is an interactive autoloaded compiled Lisp function in
| `python.el'.
|
| (run-python CMD &optional DEDICATED SHOW)
|
| Run an inferior Python process.
| Input and output via buffer named after
| `python-shell-buffer-name'. If there is a process already
| running in that buffer, just switch to it.
`----
So I changed the call to
(run-python py-python-command)
and then all the code blocks could execute with no problem. Has
run-python changed signature recently?
This may or may not be the problem you are running into however.
Nick