Hi list. I try to process my data in python. I store outputs from different scripts in separate txt files and load data using numpy.loadtxt. I want to change it store outputs in results tables.
So I have this example table #+TBLNAME: test-table | 1e212 | 2e1 | 23e3 | and use it as variable for python source code block below #+BEGIN_SRC python :var rates=test-table import numpy as np for i in range(len(rates)): rates[i]=map(float,rates[i]) rates2=np.array(rates) return np.log10(rates2) #+END_SRC #+RESULTS: | 212 | 1.30103 | 4.36172784 | works OK so far. And here comes a problem. I want to be able to debug my code in python session. I use session header argument for it and access session via org-babel-switch-to-session. #+BEGIN_SRC python :var rates=test-table :session import numpy as np for i in range(len(rates)): rates[i]=map(float,rates[i]) rates2=np.array(rates) #+END_SRC #+RESULTS: Then it does not work. And inside of session i have the following output: __________________________________________ >>> rates=[["1e212", "2e1", "23e3"]] >>> import numpy as np for i in range(len(rates)): rates[i]=map(float,rates[i]) rates2=np.array(rates) open('/tmp/babel-54890hk/python-54897vP', 'w').write(str(_)) 'org_babel_python_eoe' >>> ... ... File "<stdin>", line 3 rates2=np.array(rates) ^ SyntaxError: invalid syntax >>> >>> >>> Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name '_' is not defined >>> >>> >>> 'org_babel_python_eoe' >>> _________________________________________________________ Thank for help in advance. Petro.