emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-babel: Why isn't =:results value= working with (my) python?
@ 2010-02-04 15:06 Scott May
  2010-02-04 15:27 ` Thomas S. Dye
  0 siblings, 1 reply; 4+ messages in thread
From: Scott May @ 2010-02-04 15:06 UTC (permalink / raw)
  To: emacs-orgmode

Using org-babel, the following example produces no output for me when I execute using C-c C-c:

#+begin_src python :results value
2 + 2
#+end_src

#+results:
: None

In my messages buffer I see the following:

: (Shell command succeeded with no output)

Now the equivalent emacs-lisp example does work:

#+begin_src emacs-lisp :results value
(+ 2 2)
#+end_src

#+results:
: 4

Furthermore, 

#+begin_src python :results output
print(2 + 2)
#+end_src

#+results:
: 4

works as expected.

Am I missing something obvious? Is the problem with my python setup, or perhaps org-babel-python?

I have tested this on both my Windows and Ubuntu setups. I am using org version 6.34trans.

Cheers,
Scott


      

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: org-babel: Why isn't =:results value= working with (my) python?
  2010-02-04 15:06 org-babel: Why isn't =:results value= working with (my) python? Scott May
@ 2010-02-04 15:27 ` Thomas S. Dye
  2010-02-04 16:16   ` Dan Davison
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas S. Dye @ 2010-02-04 15:27 UTC (permalink / raw)
  To: Scott May; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1064 bytes --]

On Feb 4, 2010, at 5:06 AM, Scott May wrote:

> Using org-babel, the following example produces no output for me  
> when I execute using C-c C-c:
>
> #+begin_src python :results value
> 2 + 2
> #+end_src
>
> #+results:
> : None
>
> In my messages buffer I see the following:
>
> : (Shell command succeeded with no output)
>
> Now the equivalent emacs-lisp example does work:
>
> #+begin_src emacs-lisp :results value
> (+ 2 2)
> #+end_src
>
> #+results:
> : 4
>
> Furthermore,
>
> #+begin_src python :results output
> print(2 + 2)
> #+end_src
>
> #+results:
> : 4
>
> works as expected.
>
> Am I missing something obvious? Is the problem with my python setup,  
> or perhaps org-babel-python?
>
> I have tested this on both my Windows and Ubuntu setups. I am using  
> org version 6.34trans.
>
> Cheers,
> Scott
>

Hi Scott,

You need :session.

#+begin_src python :session :results value
2 + 2
#+end_src

#+results:
: 4

hth,
Tom

Thomas S. Dye, Ph.D.
T. S. Dye & Colleagues, Archaeologists, Inc.
Phone: (808) 529-0866 Fax: (808) 529-0884
http://www.tsdye.com



[-- Attachment #1.2: Type: text/html, Size: 3721 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: org-babel: Why isn't =:results value= working with (my) python?
  2010-02-04 15:27 ` Thomas S. Dye
@ 2010-02-04 16:16   ` Dan Davison
  2010-02-04 16:36     ` Scott May
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Davison @ 2010-02-04 16:16 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Scott May, emacs-orgmode

"Thomas S. Dye" <tsd@tsdye.com> writes:

> On Feb 4, 2010, at 5:06 AM, Scott May wrote:
>
>
>     Using org-babel, the following example produces no output for me when I
>     execute using C-c C-c:
>
>     #+begin_src python :results value
>     2 + 2
>     #+end_src
>
>     #+results:
>     : None
>
>     In my messages buffer I see the following:
>
>     : (Shell command succeeded with no output)
>
>     Now the equivalent emacs-lisp example does work:
>
>     #+begin_src emacs-lisp :results value
>     (+ 2 2)
>     #+end_src
>
>     #+results:
>     : 4
>
>     Furthermore,
>
>     #+begin_src python :results output
>     print(2 + 2)
>     #+end_src
>
>     #+results:
>     : 4
>
>     works as expected.
>
>     Am I missing something obvious? Is the problem with my python setup, or
>     perhaps org-babel-python?
>
>     I have tested this on both my Windows and Ubuntu setups. I am using org
>     version 6.34trans.
>
>     Cheers,
>     Scott
>
>
>
> Hi Scott,
>
> You need :session.

Or, if you are going to stick with the default non-session evaluation,
you need to include a return statement:

#+begin_src python :results value
return 2 + 2
#+end_src

#+results:
: 4

This is explained in full at

http://orgmode.org/worg/org-contrib/babel/reference.php#header-argument-results

scroll down to the 2-by-2 table and the explanation below it.

Dan

>
> #+begin_src python :session :results value
> 2 + 2
> #+end_src
>
> #+results:
> : 4
>
> hth,
> Tom
>
>
> Thomas S. Dye, Ph.D.
>
> T. S. Dye & Colleagues, Archaeologists, Inc.
>
> Phone: (808) 529-0866 Fax: (808) 529-0884
>
> http://www.tsdye.com
>
>
>
> _______________________________________________
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: org-babel: Why isn't =:results value= working with (my) python?
  2010-02-04 16:16   ` Dan Davison
@ 2010-02-04 16:36     ` Scott May
  0 siblings, 0 replies; 4+ messages in thread
From: Scott May @ 2010-02-04 16:36 UTC (permalink / raw)
  To: Dan Davison, Thomas S. Dye; +Cc: emacs-orgmode

Great, thanks. Both suggestions worked.

Cheers,
Scott




----- Original Message ----
From: Dan Davison <davison@stats.ox.ac.uk>
To: Thomas S. Dye <tsd@tsdye.com>
Cc: Scott May <bscottmay@yahoo.com>; emacs-orgmode@gnu.org
Sent: Thu, February 4, 2010 11:16:43 AM
Subject: Re: [Orgmode] org-babel: Why isn't =:results value= working with (my) python?

"Thomas S. Dye" <tsd@tsdye.com> writes:

> On Feb 4, 2010, at 5:06 AM, Scott May wrote:
>
>
>     Using org-babel, the following example produces no output for me when I
>     execute using C-c C-c:
>
>     #+begin_src python :results value
>     2 + 2
>     #+end_src
>
>     #+results:
>     : None
>
>     In my messages buffer I see the following:
>
>     : (Shell command succeeded with no output)
>
>     Now the equivalent emacs-lisp example does work:
>
>     #+begin_src emacs-lisp :results value
>     (+ 2 2)
>     #+end_src
>
>     #+results:
>     : 4
>
>     Furthermore,
>
>     #+begin_src python :results output
>     print(2 + 2)
>     #+end_src
>
>     #+results:
>     : 4
>
>     works as expected.
>
>     Am I missing something obvious? Is the problem with my python setup, or
>     perhaps org-babel-python?
>
>     I have tested this on both my Windows and Ubuntu setups. I am using org
>     version 6.34trans.
>
>     Cheers,
>     Scott
>
>
>
> Hi Scott,
>
> You need :session.

Or, if you are going to stick with the default non-session evaluation,
you need to include a return statement:

#+begin_src python :results value
return 2 + 2
#+end_src

#+results:
: 4

This is explained in full at

http://orgmode.org/worg/org-contrib/babel/reference.php#header-argument-results

scroll down to the 2-by-2 table and the explanation below it.

Dan

>
> #+begin_src python :session :results value
> 2 + 2
> #+end_src
>
> #+results:
> : 4
>
> hth,
> Tom
>
>
> Thomas S. Dye, Ph.D.
>
> T. S. Dye & Colleagues, Archaeologists, Inc.
>
> Phone: (808) 529-0866 Fax: (808) 529-0884
>
> http://www.tsdye.com
>
>
>
> _______________________________________________
> 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



      

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-02-04 16:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-04 15:06 org-babel: Why isn't =:results value= working with (my) python? Scott May
2010-02-04 15:27 ` Thomas S. Dye
2010-02-04 16:16   ` Dan Davison
2010-02-04 16:36     ` Scott May

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).