From: Giovanni Moretti <g.moretti@massey.ac.nz>
To: orgmode mailing list <emacs-orgmode@gnu.org>
Subject: Bug (or at least a trap) in exporting #+begin_src blocks
Date: Mon, 24 Feb 2014 15:01:34 +1300 [thread overview]
Message-ID: <530AA7FE.1020002@massey.ac.nz> (raw)
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
next reply other threads:[~2014-02-24 2:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-24 2:01 Giovanni Moretti [this message]
2014-02-26 14:08 ` Bug (or at least a trap) in exporting #+begin_src blocks Nicolas Goaziou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=530AA7FE.1020002@massey.ac.nz \
--to=g.moretti@massey.ac.nz \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.