From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ken Mankoff Subject: Re: python :session does return Date: Tue, 14 Jan 2014 10:34:06 -0500 (EST) Message-ID: References: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W360P-0005Yz-RM for emacs-orgmode@gnu.org; Tue, 14 Jan 2014 10:34:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W360H-00058X-Dl for emacs-orgmode@gnu.org; Tue, 14 Jan 2014 10:34:17 -0500 Received: from mail-qe0-x22e.google.com ([2607:f8b0:400d:c02::22e]:41804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W360H-00058T-8x for emacs-orgmode@gnu.org; Tue, 14 Jan 2014 10:34:09 -0500 Received: by mail-qe0-f46.google.com with SMTP id 8so2186024qea.5 for ; Tue, 14 Jan 2014 07:34:08 -0800 (PST) Received: from gorgonzola.whoi.edu (gorgonzola.whoi.edu. [128.128.28.197]) by mx.google.com with ESMTPSA id v2sm1286072qer.6.2014.01.14.07.34.07 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 14 Jan 2014 07:34:08 -0800 (PST) In-Reply-To: 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: Org-mode On Tue, 14 Jan 2014, Ken Mankoff wrote: > > I've seen various historical issues with :session but it seems I may have a > different problem. This is the latest org in emacs 24.3. If I do not have > :session, then everything works just fine. > > If I C-c C-c in the following code: > > #+BEGIN_SRC python :session transect > import numpy as np > x = np.arange(12) > #+END_SRC > > Emacs hangs the first time with minibuffer message of "Sent > python-eldoc-setup-code". If I C-g, I can edit the org buffer again. All > other invocations of that code and the minibuffer message is "executing > Python code block...", but still emacs hangs until I C-g. > Hmm. If I run IPython instead of regular python by setting this: (setq org-babel-python-command "ipython --pylab --pdb --nosep") Then org does not hang. It returns as expected. However, the capturing of output doesn't seem to work right. In Org, the following: #+begin_src python :session foo x = 42 print x #+end_src Produces no RESULTS, and in the Python *foo* buffer I see: In [8]: x = 42 In [9]: print x 42 In [10]: open('/var/folders/60/jb7kfrsn2jd90hpcgj4m_wrc0000gn/T/babel-35562TZV/python-3$ In [11]: 'org_babel_python_eoe' Out[11]: 'org_babel_python_eoe' But if I remove the "print" statment in Org: #+begin_src python :session foo x = 42 x #+end_src Then the RESULTS shows me 42, and the Python *foo* buffer is: In [12]: x = 42 In [13]: x Out[13]: 42 In [14]: open('/var/folders/60/jb7kfrsn2jd90hpcgj4m_wrc0000gn/T/babel-35562TZV/python-3$ In [15]: 'org_babel_python_eoe' In [15]: Out[15]: 'org_babel_python_eoe'