From: Eric Schulte <schulte.eric@gmail.com>
To: John Hendy <jw.hendy@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>,
Gary Oberbrunner <garyo@oberbrunner.com>
Subject: Re: Fwd: run python from org, draft
Date: Fri, 29 Mar 2013 10:23:35 -0600 [thread overview]
Message-ID: <878v566up9.fsf@gmail.com> (raw)
In-Reply-To: CA+M2ft83CqpsfGghb69318rihAb4W9dSCLoXp-gSwiuHihFQ7g@mail.gmail.com
John Hendy <jw.hendy@gmail.com> writes:
> 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 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
next prev parent reply other threads:[~2013-03-29 16:24 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-28 21:55 run python from org, draft Andreas Röhler
[not found] ` <CAFChFyjZyxcnH1_jSWEUgXNkvJ0c3F8f4ojQa_EtPov2TjtziQ@mail.gmail.com>
2013-03-29 12:11 ` Fwd: " Gary Oberbrunner
2013-03-29 14:47 ` Andreas Röhler
2013-03-29 14:57 ` John Hendy
2013-03-29 15:09 ` Eric Schulte
2013-03-29 15:29 ` Andreas Röhler
2013-03-29 16:20 ` Eric Schulte
2013-03-29 16:49 ` Andreas Röhler
2013-03-29 16:59 ` Eric Schulte
2013-03-29 18:33 ` Evan Misshula
2013-03-29 18:50 ` Eric Schulte
2013-03-29 19:04 ` Evan Misshula
[not found] ` <CAFChFyhRbz6hh-NyOZTfdKJcTPh=F3J=07k2fR9p+A9Wig_pRA@mail.gmail.com>
2013-03-29 20:10 ` Fwd: " Gary Oberbrunner
2013-03-29 20:58 ` Andreas Röhler
2013-03-31 20:04 ` Gary Oberbrunner
2013-03-29 15:35 ` John Hendy
[not found] ` <CAFChFyhOrPVS2E5CE9H2+zX5TFV4D-themQbjx2DaSx-WmG14g@mail.gmail.com>
2013-03-29 20:11 ` Fwd: " Gary Oberbrunner
2013-03-29 15:50 ` John Hendy
2013-03-29 16:23 ` Eric Schulte [this message]
2013-03-29 16:47 ` Eric Schulte
2013-03-29 19:06 ` Andreas Röhler
2013-03-29 20:04 ` Andreas Röhler
2013-03-29 19:59 ` Gary Oberbrunner
2013-03-29 20:15 ` Andreas Röhler
2013-03-29 20:25 ` Eric Schulte
2013-03-29 20:45 ` Gary Oberbrunner
2013-03-29 21:13 ` Eric Schulte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878v566up9.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=garyo@oberbrunner.com \
--cc=jw.hendy@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).