[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] Re: Problem whit with code evaluation
From: |
Nick Dokos |
Subject: |
Re: [Orgmode] Re: Problem whit with code evaluation |
Date: |
Thu, 19 Aug 2010 01:05:41 -0400 |
Blanchette, Marco <address@hidden> wrote:
> Hmm... Thanks Dan.
>
> Do we have a different version of org-mode? I just pasted your code in emacs
> 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 "<stdin>", line 5, in <module>
> File "<stdin>", line 3, in main
> NameError: global name 'x' is not defined
> Error in main() : object 'x' not found
>
> On 8/18/10 9:37 PM, "Dan Davison" <address@hidden> wrote:
>
> > * The python example
> > #+source: square(x)
> > #+begin_src python
> > return x*x
> > #+end_src
> >
> > #+call: square(x=6)
> >
> > #+results: square(x=6)
> > : 36
> >
I think that's because the first source block cannot be evaluated: it
only makes sense when it is #+called. If you place the cursor in that
first source block and press C-c C-c, you get exactly the same error. If
you do the same on the #+call, it works. Since org-babel-execute-buffer
just steps through the buffer and executes every source block, it's not
too surprising that you get those errors.
So I guess the question is whether org-babel-execute-buffer should be
smarter about which source blocks to execute.
Nick