Hi Org list, I'm having with noweb and variables. Can someone explain what I'm doing wrong? For example, if I have this table:
#+NAME: table_foo | foo | |-----| | 42 | | 100 | And I want to import it into Python and use it, I can do that like this: #+NAME: import #+BEGIN_SRC python :var table=table_foo :session foo import numpy as np table = np.array(table).astype(np.float).flatten() #+END_SRC Eval of this block works, and if I tangle it, I see: > table=[[42], [100]] > import numpy as np > table = np.array(table).astype(np.float).flatten() But if I want to use that block elsewhere via noweb, it doesn't seem to work: #+BEGIN_SRC python :results output drawer :noweb yes :session foo :tangle import_noweb.py <<import()>> #+END_SRC The code runs and in a clean *foo* session I do have my table variable, but I *also* get an error. The buffer contains the text at the bottom of this message, and the tangled code in import_noweb.py is only "nil". How can I 1) run noweb blocks with variables and 2) tangle noweb blocks with variables (i.e. tangle tables into source files). Thanks, -k. table=[[42], [100]] Python 2.7.15+ (default, Jul 9 2019, 16:51:35) [GCC 7.4.0] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> >>> python.el: native completion setup loaded >>> >>> import numpy as np table = np.array(table).astype(np.float).flatten() open('/tmp/babel-Mb4ojd/python-GEnZeZ', 'w').write(str(_)) 'org_babel_python_eoe' >>> Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name '_' is not defined >>> >>> >>> 'org_babel_python_eoe' >>> >>> >>> >>> >>> 'org_babel_python_eoe' 'org_babel_python_eoe' >>>