[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Bug (or at least a trap) in exporting #+begin_src blocks

From: Giovanni Moretti
Subject: [O] Bug (or at least a trap) in exporting #+begin_src blocks
Date: Mon, 24 Feb 2014 15:01:34 +1300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

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"

: hi

** Try 2

#+BEGIN_SRC python :results output :exports both
print "Fred"
#+END_SRC python

: 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 

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"

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.


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                address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]