emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* debugging sbe calls
@ 2010-08-05 12:42 Inquisitive Scientist
  2010-08-06  8:20 ` Sébastien Vauban
  2010-08-08 11:16 ` David Maus
  0 siblings, 2 replies; 4+ messages in thread
From: Inquisitive Scientist @ 2010-08-05 12:42 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1738 bytes --]

Dear Experts,

I *love* org-babel. In trying to switch a bunch of things to using it, I
have run into the problem that if I get the syntax slightly wrong, either
nothing happens (no output) or I just get something like "ERROR". Is there a
way to understand what is causing the error? So far, I have resorted to
creating a checklist of common mistakes which I run through whenever
something doesn't work. I think many of these look like things which could
in theory be detected and warned or complained about. Any suggestions on
debugging would be much appreciated.

Below is a list of some common mistakes.

** common mistakes

*** forgetting colon on srcname

If you do the following (note the missing colon on srcname)

#+srcname Cube(x=3)
#+begin_src python :results value :export code
return x*x*x
#+end_src

then things won't work (e.g., you may get an error about "global name
'x' is not defined" which is pretty confusing).

Instead, make sure you have the colons and do

#+srcname: Cube(x=3)
#+begin_src python :results value :export both
return x*x*x
#+end_src

which gives

#+results: Cube
: 27

*** forgetting = in chained sbe call

Make sure you include the = sign in a chained sbe call like the
following:

| 512 |
#+TBLFM: @1$1='(sbe "Cube" (x "Cube(x=2)"))

If you forget the = as in
| 19683 |
#+TBLFM: @1$1='(sbe "Cube" (x "Cube(x 1)"))

or if you forget a quote as in
| #ERROR |
#+TBLFM: @1$1='(sbe "Cube" (x "Cube(x=2)))
it won't work.

*** getting confused on sbe call

It's common to forget that the sbe syntax uses pairs *without* the
equal sign. Consequently, something like
| #ERROR |
#+TBLFM: @1$1='(sbe "Cube" (x=2))

won't work but something like

| 8 |
#+TBLFM: @1$1='(sbe "Cube" (x 2))

will do what you want.

[-- Attachment #1.2: Type: text/html, Size: 2096 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-08 16:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05 12:42 debugging sbe calls Inquisitive Scientist
2010-08-06  8:20 ` Sébastien Vauban
2010-08-06  9:53   ` Dan Davison
2010-08-08 11:16 ` David Maus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).