From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: session with python-mode.el complains of void py-toggle-shells Date: Tue, 22 Jan 2013 23:11:29 -0500 Message-ID: <3314.1358914289@alphaville> References: <87ham8y5rw.fsf@gmail.com> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([208.118.235.92]:41547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxrgV-0001DJ-Cl for Emacs-orgmode@gnu.org; Tue, 22 Jan 2013 23:11:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TxrgS-0001en-H1 for Emacs-orgmode@gnu.org; Tue, 22 Jan 2013 23:11:35 -0500 Received: from g4t0015.houston.hp.com ([15.201.24.18]:32186) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxrgS-0001eX-84 for Emacs-orgmode@gnu.org; Tue, 22 Jan 2013 23:11:32 -0500 In-Reply-To: Message from Myles English of "Wed, 23 Jan 2013 02:47:31 GMT." <87ham8y5rw.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Myles English Cc: Emacs-orgmode Myles English 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