From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [BUG] org-babel :session breaks returning things with python? Date: Sat, 27 Nov 2010 17:46:30 -0700 Message-ID: <871v669swp.fsf@gmail.com> References: <87hbfxt6zm.fsf@dustycloud.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=37505 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PMVPd-00046N-86 for emacs-orgmode@gnu.org; Sat, 27 Nov 2010 19:46:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PMVPb-0007id-C8 for emacs-orgmode@gnu.org; Sat, 27 Nov 2010 19:46:41 -0500 Received: from mail-px0-f169.google.com ([209.85.212.169]:62727) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PMVPb-0007iX-4V for emacs-orgmode@gnu.org; Sat, 27 Nov 2010 19:46:39 -0500 Received: by pxi12 with SMTP id 12so2452999pxi.0 for ; Sat, 27 Nov 2010 16:46:38 -0800 (PST) In-Reply-To: <87hbfxt6zm.fsf@dustycloud.org> (Christopher Allan Webber's message of "Thu, 04 Nov 2010 10:59:25 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Christopher Allan Webber Cc: emacs-orgmode@gnu.org Hi, A recent commit fixes this issue. Instead of placing a return call inside of a python code block it is now possible to use a new :return header argument to specify the value to be returned. e.g. #+begin_src python :return squared_plus(2) def squared_plus(x): return x*x+1 #+end_src #+results: : 5 Best -- Eric Christopher Allan Webber writes: > Hello, > > In the latest org master, I get this issue: > > #+BEGIN_SRC python > return 33 > #+END_SRC > > #+results: > : 33 > > #+BEGIN_SRC python :session > return 33 > #+END_SRC > > #+results: > : org_babel_python_eoe > > Not really sure what's happening, but I'm seeing inside of *Python*: > > : >>> return 33 > : > : open('/tmp/babel-283184et/python-28318XQy', 'w').write(str(_)) > : > : > : 'org_babel_python_eoe' > : File "", line 1 > : SyntaxError: 'return' outside function > : >>> >>> >>> Traceback (most recent call last): > : File "", line 1, in > : NameError: name '_' is not defined > : >>> >>> >>> 'org_babel_python_eoe' > : >>> > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode