From mboxrd@z Thu Jan 1 00:00:00 1970 From: Inquisitive Scientist Subject: debugging sbe calls Date: Thu, 5 Aug 2010 08:42:00 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0966069844==" Return-path: Received: from [140.186.70.92] (port=44833 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oh2TP-0006mE-Fr for emacs-orgmode@gnu.org; Thu, 05 Aug 2010 11:35:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oh2TN-0004jZ-Ks for emacs-orgmode@gnu.org; Thu, 05 Aug 2010 11:35:11 -0400 Received: from mail-gy0-f169.google.com ([209.85.160.169]:60625) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oh2TN-0004jN-Ic for emacs-orgmode@gnu.org; Thu, 05 Aug 2010 11:35:09 -0400 Received: by gyb11 with SMTP id 11so3421162gyb.0 for ; Thu, 05 Aug 2010 08:35:09 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --===============0966069844== Content-Type: multipart/alternative; boundary=0016e644029a5f8fdb048d12e0a3 --0016e644029a5f8fdb048d12e0a3 Content-Type: text/plain; charset=ISO-8859-1 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. --0016e644029a5f8fdb048d12e0a3 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Dear Experts,

I *love* org-babel. In trying to switch a bunch of thi= ngs to using it, I have run into the problem that if I get the syntax sligh= tly 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 abo= ut. Any suggestions on debugging would be much appreciated.

Below is a list of some common mistakes.

** common mistakes
<= br>*** forgetting colon on srcname

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

#+srcname Cube(x=3D3)
#+begin_src pyt= hon :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" wh= ich is pretty confusing).

Instead, make sure you have the colons and= do

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

which gives

#+results: Cube: 27

*** forgetting =3D in chained sbe call

Make sure you i= nclude the =3D sign in a chained sbe call like the
following:

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

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

*** ge= tting confused on sbe call

It's common to forget that the sbe sy= ntax uses pairs *without* the
equal sign. Consequently, something like
| #ERROR |
#+TBLFM: @1$1=3D&= #39;(sbe "Cube" (x=3D2))

won't work but something like=

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

w= ill do what you want.


--0016e644029a5f8fdb048d12e0a3-- --===============0966069844== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============0966069844==--