[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] Need control over insertion point of variables in code blocks
From: |
Dirk Scharff |
Subject: |
[O] Need control over insertion point of variables in code blocks |
Date: |
Fri, 22 Jul 2011 09:22:36 +0200 |
Hi
i just noticed that variables are assigned in the top of the exported code.
That can be problematic in some situations:
#+source: the_test
#+begin_src python :var x=3 :tangle test.py :results output
from __future__ import division
print x
#+end_src
tangling results in:
x=3
from __future__ import division
print x
The problem with the result is simple:
SyntaxError: from __future__ imports must occur at the beginning of the file
To export this correctly I'd need the possibility to tell org-mode where the
variables are supposed to be inserted. Is there a way to do this? I didn't find
a keyword for this in the documentation.
A second problem I have at the moment lies with the execution of source-blocks
in tables. What I'd like to do:
| argument | result |
| 1 | #ERROR |
| | |
#+TBLFM: $2=call_the_test(x=$<)
I guess I'm just doing something wrong here. Executing the #+Tblfm results in
the error: "reference $< not found in buffer". How do I do the reference
correctly in this case?
You can test both cases in the attached org-file.
testing.org
Description: Binary data
- [O] Need control over insertion point of variables in code blocks,
Dirk Scharff <=