From: John Hendy <jw.hendy@gmail.com>
To: Ken Mankoff <mankoff@gmail.com>
Cc: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: python :session does return
Date: Wed, 15 Jan 2014 15:08:27 -0600 [thread overview]
Message-ID: <CA+M2ft8e6Hiwt=vxJo-kV6_kSPDoOLJkPJiVsaPUyn24PVCD9w@mail.gmail.com> (raw)
In-Reply-To: <CAFdBzEraUeuN90+qzB70Wu8Mgbs_8ktoDJ-Y-WVcwAX07EW5pw@mail.gmail.com>
On Wed, Jan 15, 2014 at 6:22 AM, Ken Mankoff <mankoff@gmail.com> wrote:
> Hi John,
>
> Yes, you and others in that thread seem to be experiencing the same problem,
> although there are also different issues discussed there.
>
> I'm a bit surprised... With the popularity of python I would expect more org
> users to have run into this and it to be fixed, but perhaps it isn't as
> widely used as I thought. Anyway, it is now usable even if the 'print'
> statements don't show up.
Sorry I haven't been following along quite as closely as I probably
should have... I booted into Linux to remove the issue of setting up
python on my Windows partition. Are my results contrary to what's been
happening to you?
#+begin_src ~/Desktop/test.org
* heading
Using =:results output=
#+BEGIN_SRC python :results output :session transect
import numpy as np
x = np.arange(12)
print x
#+END_SRC
#+RESULTS:
:
: >>> [ 0 1 2 3 4 5 6 7 8 9 10 11]
#+end_src
#+begin_src ~/Desktop/test.org
* heading
I can also use =:results value= and it spits out an org table
#+BEGIN_SRC python :results value :session transect
import numpy as np
x = np.arange(12)
x
#+END_SRC
#+RESULTS:
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
#+end_src
#+begin_src Emacs *transect* buffer
>>> import numpy as np
>>> x = np.arange(12)
>>> print x
[ 0 1 2 3 4 5 6 7 8 9 10 11]
>>>
>>>
>>>
>>> 'org_babel_python_eoe'
'org_babel_python_eoe'
>>>
#+end_src
#+begin_src .emacs
;; Arch linux installs python3 by default, and python is bound to it
;; need to set this variable to make sure we're using python v2
(setq org-babel-python-command "python2")
#+end_src
$ python2 --version
Python 2.7.6
M-x org-version
Org-mode version 8.2.3c (release_8.2.3c-227-g54a64f @
/home/jwhendy/.elisp/org.git/lisp/)
$ emacs --version
GNU Emacs 24.3.1
I think the :session name -> a *name* session is still a bit goofy,
but I at the very least I wanted to share that I don't get any hanging
behavior and seem to get coherent results out of a python babel code
block.
Best regards,
John
>
> -k.
>
>
>
> On Tue, Jan 14, 2014 at 6:04 PM, John Hendy <jw.hendy@gmail.com> wrote:
>>
>> On Tue, Jan 14, 2014 at 7:38 AM, Ken Mankoff <mankoff@gmail.com> 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.
>> >
>>
>> This sounded familiar to me, so I googled around for Org mailing list
>> discussions I was involved in related to python. Does this shed any
>> new light?
>> - https://www.mail-archive.com/emacs-orgmode@gnu.org/msg68542.html
>>
>> Seems that the discussion ended with the possibility that it was an
>> emacs change to python.el, and not related to Org, but I'm not sure if
>> any actions were ever taken regarding that. In any case, the
>> discussion features a discrepancy between python behavior with
>> `:session name` and without, so it seemed like a possible candidate to
>> pass along!
>>
>>
>>
>> Best regards,
>> John
>>
>> > 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.
>> >
>> > If I look at the *transect* buffer, I see the following. The code runs
>> > just
>> > fine, but for some reason it does not return.
>> >
>> > -k.
>> >
>> >
>> >
>> > Enthought Canopy Python 2.7.3 | 64-bit | (default, Dec 2 2013,
>> > 16:19:29)
>> > [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
>> > Type "help", "copyright", "credits" or "license" for more information.
>> > import numpy as np
>> > Start .pythonrc
>> > End .pythonrc
>> >>>>
>> >>>> import numpy as np
>> >
>> > x = np.arange(12)
>> > x = np.arange(12)
>> >
>> >
>> >
>> > open('/var/folders/60/jb7kfrsn2jd90hpcgj4m_wrc0000gn/T/babel-28022EFF/python-28022Yjm',
>> > 'w').write(str(_))
>> >
>> > open('/var/folders/60/jb7kfrsn2jd90hpcgj4m_wrc0000gn/T/babel-28022EFF/python-28022Yjm',
>> > 'w').write(str(_))
>> >
>> >
>> >
>> >
>> > 'org_babel_python_eoe'
>> > 'org_babel_python_eoe'
>> >>>>
>> >>>> >>> >>> >>> >>> >>> Traceback (most recent call last):
>> >
>> > File "<stdin>", line 1, in <module>
>> > NameError: name '_' is not defined
>> >>>>
>> >>>> >>> >>> 'org_babel_python_eoe'
>> >>>> import numpy as np
>> >
>> > import numpy as np
>> > x = np.arange(12)
>> >>>>
>> >>>> x = np.arange(12)
>> >
>> >
>> >>>>
>> >
>> > open('/var/folders/60/jb7kfrsn2jd90hpcgj4m_wrc0000gn/T/babel-28022EFF/python-28022lts',
>> > 'w').write(str(_))
>> >>>>
>> >>>>
>> >
>> > open('/var/folders/60/jb7kfrsn2jd90hpcgj4m_wrc0000gn/T/babel-28022EFF/python-28022lts',
>> > 'w').write(str(_))
>> >
>> >>>>
>> >
>> >>>>
>> > 'org_babel_python_eoe'
>> >>>>
>> >>>> 'org_babel_python_eoe'
>> >
>> > 'org_babel_python_eoe'
>> >>>>
>> >>>>
>> >
>> >
>> >
>> >
>
>
next prev parent reply other threads:[~2014-01-15 21:08 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
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 [this message]
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='CA+M2ft8e6Hiwt=vxJo-kV6_kSPDoOLJkPJiVsaPUyn24PVCD9w@mail.gmail.com' \
--to=jw.hendy@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=mankoff@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).