I'm tying to set default header arguments to the code blocks within my org file, like this:

#+PROPERTY: header-args  :session *my_python_session*
#+PROPERTY: header-args  :results silent
#+PROPERTY: header-args  :tangle yes

My code blocks look like this:

#+BEGIN_SRC python
  import pandas as pd

However, when I call org-babel-tangle from this buffer, I get Tangled 0 code blocks from filename.org. When I add :tangle yes to the end of the #+BEGIN_SRC line, the code block is exported when I call org-babel-tangle.

I would expect that I don't need to set :tangle yes on each code block. What am I doing wrong?


You should have every header argument in one line:

#+PROPERTY: header-args :session *my_python_session* :results silent :tangle yes

Having several #+PROPERTY lines is accepted, but not in the way you're trying to do it.

From the Org manual (7.1 Property syntax):

If you want to add to the value of an existing property, append a ‘+’ to the property name. The following results in the property ‘var’ having the value “foo=1 bar=2”.

#+PROPERTY: var  foo=1
#+PROPERTY: var+ bar=2

So, since header-args is the property and :session, :results and :tangle are its values, it should be:

#+PROPERTY: header-args :session *my_python_session*
#+PROPERTY: header-args+ :results silent
#+PROPERTY: header-args+ :tangle yes

But it's easier to have just one line IMO.

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.