emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Myles English <mylesenglish@gmail.com>
Cc: Emacs-orgmode <Emacs-orgmode@gnu.org>
Subject: Re: session with python-mode.el complains of void py-toggle-shells
Date: Tue, 22 Jan 2013 23:11:29 -0500	[thread overview]
Message-ID: <3314.1358914289@alphaville> (raw)
In-Reply-To: Message from Myles English <mylesenglish@gmail.com> of "Wed, 23 Jan 2013 02:47:31 GMT." <87ham8y5rw.fsf@gmail.com>

Myles English <mylesenglish@gmail.com> 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

  reply	other threads:[~2013-01-23  4:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-23  2:47 session with python-mode.el complains of void py-toggle-shells Myles English
2013-01-23  4:11 ` Nick Dokos [this message]
2013-01-23 12:46   ` [PATCH] " Myles English
2013-01-23 13:04     ` Bastien
2013-01-23 18:02       ` Andreas Röhler
2013-01-24 14:10         ` Bastien
2013-02-21 20:08           ` Andreas Röhler
2013-02-22  8:25           ` Andreas Röhler
2013-02-23  9:29             ` Bastien
2013-01-23 13:00   ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2011-10-28  1:23 [odt] equation labels Myles English
2011-10-30 22:11 ` Jambunathan K
2011-10-31 11:54   ` Myles English
2011-11-01 11:17     ` Myles English
2011-11-01 19:39     ` Jambunathan K
2011-11-01 19:49       ` Jambunathan K
2011-11-02 13:18       ` Myles English
     [not found]         ` <mylesenglish@gmail.com>
2011-11-02 13:38           ` Nick Dokos
2011-11-02 14:49             ` Myles English
2011-11-02 14:52           ` Nick Dokos
2011-11-02 18:21             ` Jambunathan K
2011-11-02 21:33               ` Myles English

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3314.1358914289@alphaville \
    --to=nicholas.dokos@hp.com \
    --cc=Emacs-orgmode@gnu.org \
    --cc=mylesenglish@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).