From mboxrd@z Thu Jan 1 00:00:00 1970 From: Giovanni Moretti Subject: Bug (or at least a trap) in exporting #+begin_src blocks Date: Mon, 24 Feb 2014 15:01:34 +1300 Message-ID: <530AA7FE.1020002@massey.ac.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHkra-0001Ut-BH for emacs-orgmode@gnu.org; Sun, 23 Feb 2014 21:01:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WHkrT-0001oE-P6 for emacs-orgmode@gnu.org; Sun, 23 Feb 2014 21:01:46 -0500 Received: from mu-mail3.massey.ac.nz ([130.123.129.187]:55230) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHkrT-0001n0-1F for emacs-orgmode@gnu.org; Sun, 23 Feb 2014 21:01:39 -0500 Received: from tur-mm4.massey.ac.nz (tur-mm4.massey.ac.nz [130.123.96.132]) by mu-mail3.massey.ac.nz (Postfix) with ESMTP id 7771C1B31CC for ; Mon, 24 Feb 2014 15:01:32 +1300 (NZDT) 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: orgmode mailing list I've just solved a puzzle finding out why Python src blocks that exported happily last year don't now. I'm using them for class tutorials and a of about fifteen Python fragments, a couple of the blocks would expand in-situ (C-c C-c) but when exported were treated as normal text. I narrowed it down using the following file ============== #+options: num:nil toc:nil ** Try 1 #+BEGIN_SRC python :results output :exports both print "hi" #+END_SRC #+RESULTS: : hi ** Try 2 #+BEGIN_SRC python :results output :exports both print "Fred" #+END_SRC python #+RESULTS: : Fred ==================== Both of the src blocks can be isolated and edited in its own buffer using org-babel-expand-src-block - C-c C-v C-v) and both get run correctly if you C-c C-c inside them, as shown by the #+RESULTS blocks, however on export, the second one is treated as normal text . Puzzlingly, a hex-dump showed the #+BEGIN_SRC lines were identical - then I noticed that the #+END line was wrong. I'd written "#+END_SRC python" instead of just "#+END_SRC". It seems like the parser for the src blocks is now stricter that it was last year. Could I ask that an error message be generated for this? While not strictly a bug, it's an insidious trap given that the in-buffer expansion (C-c C-c) runs and inserts the results as expected. I've also had similar problems with #+BEGIN_SRC python :output results :exports both print "hi" #+END_SRC which looks ok, and the ":output results" makes sense when you read it, but should be ":results output". From memory, this also worked in-buffer but would silently fail on export. Orgmode + Babel is excellent for writing Python tutorial worksheets - so thank you - your work is much appreciated. Cheers Giovanni -- ====================================================================== Dr Giovanni Moretti | School of Engineering and Advanced Technology Senior Lecturer | Massey University, Palmerston North, New Zealand Computer Science | Ph +64-6-3505799x84134 Fax +64-6-3502259 - ZL2GX ====================================================================== http://seat.massey.ac.nz/moretti G.Moretti@massey.ac.nz