emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Fwd: run python from org, draft


From: John Hendy
Subject: Re: [O] Fwd: run python from org, draft
Date: Fri, 29 Mar 2013 10:35:37 -0500


On Fri, Mar 29, 2013 at 10:09 AM, Eric Schulte <address@hidden> 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


reply via email to

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