From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Blanchette, Marco" Subject: Re: Problem whit with code evaluation Date: Wed, 18 Aug 2010 22:01:23 -0500 Message-ID: References: <874oerxr8p.fsf@stats.ox.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=40218 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OlvNY-00047f-PR for emacs-orgmode@gnu.org; Wed, 18 Aug 2010 23:01:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OlvNX-0005wg-G3 for emacs-orgmode@gnu.org; Wed, 18 Aug 2010 23:01:20 -0400 Received: from mail01.stowers.org ([12.201.176.8]:55379 helo=stowers.org) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OlvNX-0005wO-51 for emacs-orgmode@gnu.org; Wed, 18 Aug 2010 23:01:19 -0400 In-Reply-To: <874oerxr8p.fsf@stats.ox.ac.uk> Content-Language: en 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: Dan Davison Cc: "emacs-orgmode@gnu.org" Hmm... Thanks Dan. Do we have a different version of org-mode? I just pasted your code in emac= s and try to execute it with M-x org-babel-execute-buffer RET without success= . The emacs-lisp code works but the python and the R crashes with the following errors taken from the *Org-Babel Error* Output buffer Traceback (most recent call last): File "", line 5, in File "", line 3, in main NameError: global name 'x' is not defined Error in main() : object 'x' not found Calls: write.table -> is.data.frame -> inherits -> main Execution halted The first 4 lines comes from the python script while the last 3 come from the R script Here is my .emacs org-mode configs in case you are wondering... ;;Load org-mode and set global keys (require 'org-install) (add-to-list 'auto-mode-alist '("\\.org$" . org-mode)) (add-hook 'org-mode-hook 'turn-on-font-lock) ; not needed when global-font-lock-mode is on (define-key global-map "\C-cl" 'org-store-link) (define-key global-map "\C-ca" 'org-agenda) (setq org-log-done t) (setq org-startup-indented t) ;; active Babel languages (org-babel-do-load-languages 'org-babel-load-languages '( (R . t) (sh .t) (python . t) (emacs-lisp . t) ) ) Thanks again On 8/18/10 9:37 PM, "Dan Davison" wrote: > * The python example > #+source: square(x) > #+begin_src python > return x*x > #+end_src >=20 > #+call: square(x=3D6) >=20 > #+results: square(x=3D6) > : 36 >=20 > * The elisp example of the fibonacci series using a table as argument >=20 > #+tblname: fibonacci-inputs > | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | > | 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | >=20 > #+srcname: fibonacci-seq(fib-inputs=3Dfibonacci-inputs) > #+begin_src emacs-lisp > (defun fibonacci (n) > (if (or (=3D n 0) (=3D n 1)) > n > (+ (fibonacci (- n 1)) (fibonacci (- n 2))))) > =20 > (mapcar (lambda (row) > (mapcar #'fibonacci row)) fib-inputs) > #+end_src >=20 > #+results: fibonacci-seq > | 1 | 1 | 2 | 3 | 5 | 8 | 13 | 21 | 34 | 55 | > | 1 | 3 | 8 | 21 | 55 | 144 | 377 | 987 | 2584 | 6765 | >=20 > * Then my own trial in R > #+srcname: test(x, y) > #+begin_src R > p <- x*y > #+end_src >=20 > #+call: test(x=3D4, y=3D9) >=20 > #+results: test(x=3D4, y=3D9) > : 36 >=20 > #+lob: test(x=3D3, y=3D8) >=20 > #+results: test(x=3D3, y=3D8) > : 24 -- Marco Blanchette, Ph.D. Assistant Investigator Stowers Institute for Medical Research 1000 East 50th St. Kansas City, MO 64110 Tel: 816-926-4071 Cell: 816-726-8419 Fax: 816-926-2018