2

I am trying to pass an argument to a groovy babel block but I'm not sure it accepts arguments? The documentation says that it is language-specific but I didn't find any documentation for ob-groovy.

For example, I want to try to feed one section of my document into the groovy block:

#+NAME:current_paths

path1
path2
path3


** Groovy Processing
#+BEGIN_SRC groovy :var paths=current_paths :results output :cache yes
    paths.each {
      println "PATH: $it"
    }
#+END_SRC

But I get:

Caught: groovy.lang.MissingPropertyException: 
No such property: paths     for class: groovy-6160mqV
    at groovy-6160mqV.run(groovy-6160mqV:2)

Does anyone know if groovy babel support includes arguments? Or maybe I'm doing this wrong?

1

Looking at the source code you linked, it seems that no, there is no support for the :vars parameter.

The :results and :cache parameters should be handled directly by org-babel so these should work.


If you're interested in the details, the function used to expand the source code body (mainly in charge of adding code before and after, and initializing variables) is the generic function org-babel-expand-body:generic (not a groovy-specific function), and the third (optional) parameter of this function (lines to add to define variables) is not specified.

  • I see. . thanks for the extra info explaining where the arguments support comes from. – AndyJ May 29 '15 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.