From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Fwd: run python from org, draft Date: Fri, 29 Mar 2013 10:23:35 -0600 Message-ID: <878v566up9.fsf@gmail.com> References: <5154BC51.1050001@easy-emacs.de> <5155A97D.2090907@easy-emacs.de> <87sj3e6y5n.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:49919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULc64-0003ug-45 for emacs-orgmode@gnu.org; Fri, 29 Mar 2013 12:24:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULc5z-00049P-Ij for emacs-orgmode@gnu.org; Fri, 29 Mar 2013 12:24:08 -0400 Received: from mail-da0-x22b.google.com ([2607:f8b0:400e:c00::22b]:49691) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULc5z-000499-CR for emacs-orgmode@gnu.org; Fri, 29 Mar 2013 12:24:03 -0400 Received: by mail-da0-f43.google.com with SMTP id u36so273972dak.16 for ; Fri, 29 Mar 2013 09:24:02 -0700 (PDT) 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: John Hendy Cc: emacs-orgmode , Gary Oberbrunner John Hendy writes: > On Fri, Mar 29, 2013 at 10:09 AM, Eric Schulte wrote: > >> >> with current >> >> >> >> GNU Emacs 24.3.1 (i686-pc-linux-gnu, GTK+ Version 2.24.14) of 2013-03-05 >> >> >> >> Org-mode version 7.9.3f (release_7.9.3f-17-g7524ef @ >> >> MY_PATH/emacs-24.3/lisp/org/) >> >> >> >> python from org-source seems completely broken. >> >> >> >> For example: >> >> >> >> #+BEGIN_SRC python >> >> 1+2 >> >> #+END_SRC >> >> >> >> #+RESULTS: >> >> : None >> >> >> >> >> > Weird. With all the testing we did last week, I'm surprised that this is >> > the case with me as well. I'm also getting no results with Org 8.0-pre >> and >> > Emacs 24.3.1. >> > >> >> Because of quirks of the python language, when executing outside of a >> session, it is necessary to explicitly specify a return. >> >> For example. >> >> #+begin_src python >> return 1+2 >> #+end_src >> >> #+RESULTS: >> : 3 >> >> or >> >> #+begin_src python :return x >> x = 1+2 >> #+end_src >> >> #+RESULTS: >> : 3 >> >> This is clearly stated in the Python documentation on Worg. >> http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html >> >> > This isn't working for me on Org-8.0 (from that Worg page): > > #+begin_src python :session > def foo(x): > if x>0: > return x+1 > else: > return x-1 > > foo(1) > #+end_src > > #+RESULTS: > : None > As we've proven a couple of times now, Python session are broken with the newest version of Emacs (since the upstream change to an entirely new python.el implementation). That is the cause of your example above. > > I tend to agree. I don't/haven't used Python, but having now read the > ob-doc-python bit, it seems peculiar/undesirable to have to change > indenting, line breaking, and return statements depending on :session or > not... > I'd refer you to the previous discussion on the mailing list. I personally don't use Python and don't care, but others who have used Python more extensively than you or I argued for the existing behavior, so I'd rather not change it back capriciously. Thanks, > > John > > > >> Thanks, >> >> -- >> Eric Schulte >> http://cs.unm.edu/~eschulte >> -- Eric Schulte http://cs.unm.edu/~eschulte