From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Hendy Subject: Re: Fwd: run python from org, draft Date: Fri, 29 Mar 2013 10:35:37 -0500 Message-ID: References: <5154BC51.1050001@easy-emacs.de> <5155A97D.2090907@easy-emacs.de> <87sj3e6y5n.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=90e6ba30967cd9c5b104d9120582 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:37781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULbLB-0005Kd-7q for emacs-orgmode@gnu.org; Fri, 29 Mar 2013 11:35:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULbL9-0005MY-34 for emacs-orgmode@gnu.org; Fri, 29 Mar 2013 11:35:41 -0400 Received: from mail-la0-x235.google.com ([2a00:1450:4010:c03::235]:37191) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULbL8-0005MP-NK for emacs-orgmode@gnu.org; Fri, 29 Mar 2013 11:35:39 -0400 Received: by mail-la0-f53.google.com with SMTP id fr10so635519lab.12 for ; Fri, 29 Mar 2013 08:35:37 -0700 (PDT) In-Reply-To: <87sj3e6y5n.fsf@gmail.com> 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: Eric Schulte Cc: emacs-orgmode , Gary Oberbrunner --90e6ba30967cd9c5b104d9120582 Content-Type: text/plain; charset=UTF-8 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 > > Thanks, > > -- > Eric Schulte > http://cs.unm.edu/~eschulte --90e6ba30967cd9c5b104d9120582 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Fri, Mar 29, 2013 at 10:09 AM, Eric Schulte <schulte.eric@gmail.com> 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 t= hat this is
> > the case with me as well. I'm also getting no results with Or= g 8.0-pre and
> > Emacs 24.3.1.
> >
>
> Because of quirks of the python language, when executing outside of a<= br> > session, it is necessary to explicitly specify a return.
>
> For example.
>
> =C2=A0 =C2=A0 #+begin_src python
> =C2=A0 =C2=A0 =C2=A0 return 1+2
> =C2=A0 =C2=A0 #+end_src
>
> =C2=A0 =C2=A0 #+RESULTS:
> =C2=A0 =C2=A0 : 3
>
> or
>
> =C2=A0 =C2=A0 #+begin_src python :return x
> =C2=A0 =C2=A0 =C2=A0 x =3D 1+2
> =C2=A0 =C2=A0 #+end_src
>
> =C2=A0 =C2=A0 #+RESULTS:
> =C2=A0 =C2=A0 : 3
>
> This is clearly stated in the Python documentation on Worg.
> http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-pyt= hon.html
>

This isn't working for me on Org-8.0 (from that Worg page):

#+begin_src python :session
def foo(x):
=C2=A0 if x>0:
=C2=A0 =C2=A0 return x+1
=C2=A0 else:
=C2=A0 =C2=A0 return x-1

foo(1)
#+end_src

#+RESULTS:
: None

=C2=A0
>
> Thanks,
>
> --
> Eric Schulte
> http://cs.unm.edu/~eschulte

--90e6ba30967cd9c5b104d9120582--