From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: org-babel: Why isn't =:results value= working with (my) python? Date: Thu, 04 Feb 2010 11:16:43 -0500 Message-ID: <87d40lyo0k.fsf@stats.ox.ac.uk> References: <852251.91747.qm@web65608.mail.ac4.yahoo.com> <3F2CB3C4-F33B-47C2-BFF3-84774D0A3F07@tsdye.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nd4Nu-00054R-1W for emacs-orgmode@gnu.org; Thu, 04 Feb 2010 11:16:50 -0500 Received: from [199.232.76.173] (port=54681 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nd4Ns-00054I-Mp for emacs-orgmode@gnu.org; Thu, 04 Feb 2010 11:16:48 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nd4Nr-0008KM-1O for emacs-orgmode@gnu.org; Thu, 04 Feb 2010 11:16:48 -0500 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:59203) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nd4Nq-0008KG-M9 for emacs-orgmode@gnu.org; Thu, 04 Feb 2010 11:16:46 -0500 In-Reply-To: <3F2CB3C4-F33B-47C2-BFF3-84774D0A3F07@tsdye.com> (Thomas S. Dye's message of "Thu, 4 Feb 2010 05:27:41 -1000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Thomas S. Dye" Cc: Scott May , emacs-orgmode@gnu.org "Thomas S. Dye" 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