From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?B?QW5kcmVhcyBSw7ZobGVy?= Subject: Re: python sessions Date: Wed, 20 Mar 2013 08:08:17 +0100 Message-ID: <51496061.20706@easy-emacs.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:50547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UID7F-000505-A5 for emacs-orgmode@gnu.org; Wed, 20 Mar 2013 03:07:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UID7E-0005hv-4w for emacs-orgmode@gnu.org; Wed, 20 Mar 2013 03:07:17 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:61481) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UID7D-0005hg-Rf for emacs-orgmode@gnu.org; Wed, 20 Mar 2013 03:07:16 -0400 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: emacs-orgmode@gnu.org Am 20.03.2013 01:04, schrieb John Hendy: > On Tue, Mar 19, 2013 at 4:40 PM, Gary Oberbrunner wrote: >> I must be failing to understand something. I'm running Emacs 24.3 on >> Windows, with latest trunk org-mode. I can't get python functions to >> persist across blocks in session mode. Here's my foo.org: >> >> =============== >> >> * My Document >> #+BEGIN_SRC python :exports results :results output :session >> def foo(x): >> return x+1 >> print "hi" >> #+END_SRC >> >> #+RESULTS: >> : hi >> >> #+BEGIN_SRC python :exports results :results output :session >> print foo(100) >> print "bye" >> #+END_SRC >> >> ======================== >> >> In session mode, shouldn't foo be defined in the second python block? When >> I export this, I get "NameError: name 'foo' is not defined" >> >> I may be doing something wrong, because if I name my python session, I never >> see a buffer of that name, and I expected to. Any help? >> >> -- >> Gary > > You should probably post your babel configuration from .emacs. This > works for me (mostly). I'm using python 3.3 Hi John, let's point out though that matter is not at stake. As the OP got output, system Python must be a 2... Best, Andreas and so the print function > has changed to requiring parentheses. I can switch to a buffer called > *Python*, however, and =print("hi")= works fine. > > If I change to =print(foo(100))=, I get 101 in the #+RESULTS block. > > It's probably got something to do with your setup; taking a look at > your config should help others help you out. > > > Best regards, > John > >