0

I have an org-mode file foo.org:

#+TITLE: My Title

Hello world!

#+BEGIN_SRC python :exports none
  with open('foo.txt', 'a') as f:
      f.write('text appended!')
#+END_SRC

Issuing C-c C-e t a writes foo.txt. My python block should append the text text appended! to foo.txt. Is it possible to make this happen automatically upon export?

According to the answer to this question, the code

#+TITLE: My Title

Hello world!

#+name: test
#+BEGIN_SRC python :exports none
  with open('foo.txt', 'a') as f:
      f.write('text appended!')
#+END_SRC

#+CALL: test()

should work, but it is not working for me.

  • 1
    Possible duplicate of Execute src block on org mode export – erikstokes Aug 3 '17 at 1:14
  • @erikstokes The answer to that question does not fix my problem. I've updated my question to address this. – Brian Fitzpatrick Aug 3 '17 at 1:25
  • 1
    It works for me with Emacs 25.2 and Org mode version 9.0.5 (release_9.0.5-81-g137c6a) – rvf0068 Aug 3 '17 at 14:53

Your Answer

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

Browse other questions tagged or ask your own question.