From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [BUG][babel] ":result output table" doesn't work for python code blocks Date: Thu, 14 Apr 2011 20:26:12 -0600 Message-ID: <87oc485jy3.fsf@gmail.com> References: <87k4ew2vfu.fsf@are.berkeley.edu> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:55455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QAYjm-000330-9T for emacs-orgmode@gnu.org; Thu, 14 Apr 2011 22:26:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QAYjk-0001iv-Je for emacs-orgmode@gnu.org; Thu, 14 Apr 2011 22:26:22 -0400 Received: from mail-pv0-f169.google.com ([74.125.83.169]:40686) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QAYjk-0001il-F9 for emacs-orgmode@gnu.org; Thu, 14 Apr 2011 22:26:20 -0400 Received: by pvg4 with SMTP id 4so1140342pvg.0 for ; Thu, 14 Apr 2011 19:26:19 -0700 (PDT) In-Reply-To: <87k4ew2vfu.fsf@are.berkeley.edu> (Ethan Ligon's message of "Thu, 14 Apr 2011 17:46:13 -0700") 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: Ethan Ligon Cc: emacs-orgmode@gnu.org Ethan Ligon writes: > The results from python code blocks aren't correctly returned as tables > when they should be. To wit: > > #+begin_src python :results output table > print "A,B,C" > #+end_src > > #+results: > : A,B,C > > where I'd expect to see > > #+results: > | A | B | C | > In many languages ":results output" will always return a scalar, the thinking being, that what was printed to STDOUT was a series of strings and thus should be inserted into the buffer as a string, rather than for example #+begin_src python return [1, 2, 3] #+end_src #+results: | 1 | 2 | 3 | in which case the value returned is a list, and is thus inserted into the buffer as a list. There are currently options for printing to standard out and having the results inserted as a list. For example, #+begin_src python :results output raw print "| 1 | 2 | 3 |" #+end_src #+results: | 1 | 2 | 3 | That said, I agree that in examples like yours above the returned value should be a table given that the ":results table" is explicitly stated. I've just pushed up a patch after which the following is possible. #+begin_src python :results output table print "[A, B, C]" #+end_src #+results: | A | B | C | Note that your exact example above would still not return a list as the printed value does not look like a python list. Cheers -- Eric -- Eric Schulte http://cs.unm.edu/~eschulte/