emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] python sessions


From: Ista Zahn
Subject: Re: [O] python sessions
Date: Wed, 20 Mar 2013 15:42:19 -0400

On Wed, Mar 20, 2013 at 2:43 PM, Andreas Röhler
<address@hidden> wrote:
>
>> I guess it depends on the definition of "works". I don't get python
>> buffers with the name of the :session variable.
>
>
> Reads as it works only with named sessions, but fails with unnamed

It fails to name the python process buffers. Everything else works as
expected. Consider this example:

8<---------cut here------------8<
#+BEGIN_SRC python :exports results :results output :session *foo*
  def foo(x):
    return(x+1)

#+END_SRC

#+RESULTS:


#+BEGIN_SRC python :exports results :results output :session *bar*
  def bar(x):
    return(x+2)

#+END_SRC

#+RESULTS:

#+BEGIN_SRC python :exports results :results output :session *foo*
  print(foo(100))
  print(bar(100))

#+END_SRC

#+RESULTS:
: 101
: Traceback (most recent call last):
:   File "<stdin>", line 1, in <module>
: NameError: name 'bar' is not defined

#+BEGIN_SRC python :exports results :results output :session *bar*
  print(foo(100))
  print(bar(100))

#+END_SRC

#+RESULTS:
: Traceback (most recent call last):
:   File "<stdin>", line 1, in <module>
: NameError: name 'foo' is not defined
: 102

8<---------cut here------------8<

the foo function exists when I use :session foo (and not with :session
bar), and the bar function exists when I uses :session bar (and not
with :session foo). That equals "works" in my book. The only thing
that doesn't "work" is that I have buffers

. * tmp.org               1657  Org               ~/Desktop/tmp.org
  * *Python*<2>            332  Inferior Python:
  * *Python*               332  Inferior Python:

instead of

. * tmp.org               1657  Org               ~/Desktop/tmp.org
  * *foo*                  332  Inferior Python:
  * *bar*                  332  Inferior Python:

This is with GNU Emacs 24.2.1 and Org-mode version 8.0-pre
(release_8.0-pre-54-gb5a853

Best,
Ista

>
>
>  But I do get separate
>>
>> python buffers (.e.g., *Python*, *Python*<2>) for each session, and
>> python blocks get executed in the right python process. To me that
>> equals "works", but if the issue is that the buffers don't get named
>> with the value of :session then no, that doesn't work for me either.
>>
>> Best,
>> Ista
>>
>>>
>>> Nick
>>>
>>>
>>>
>>
>>
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]