emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ken Mankoff <mankoff@gmail.com>
To: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: python :session does return
Date: Tue, 14 Jan 2014 10:34:06 -0500 (EST)	[thread overview]
Message-ID: <alpine.OSX.2.00.1401141030130.33044@tbetbambyn.jubv.rqh> (raw)
In-Reply-To: <alpine.OSX.2.00.1401140832370.33044@tbetbambyn.jubv.rqh>

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'

  reply	other threads:[~2014-01-14 15:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-14 13:38 python :session does return Ken Mankoff
2014-01-14 15:34 ` Ken Mankoff [this message]
2014-01-14 16:32   ` Nick Dokos
2014-01-14 17:48     ` Ken Mankoff
2014-01-14 17:55       ` Nick Dokos
2014-01-14 18:25         ` Ken Mankoff
2014-01-14 23:04 ` John Hendy
2014-01-15 12:22   ` Ken Mankoff
2014-01-15 19:01     ` Eric Schulte
2014-01-15 21:08     ` John Hendy
2014-01-16 20:14       ` Ken Mankoff

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=alpine.OSX.2.00.1401141030130.33044@tbetbambyn.jubv.rqh \
    --to=mankoff@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).