From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yotam Avital Subject: Passing variables between code blocks Date: Thu, 24 Jan 2013 12:01:51 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=bcaec54a35d49199ed04d405e7c9 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:47658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyJdQ-00044Y-92 for emacs-orgmode@gnu.org; Thu, 24 Jan 2013 05:02:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TyJdN-0002OI-0t for emacs-orgmode@gnu.org; Thu, 24 Jan 2013 05:02:16 -0500 Received: from mail-oa0-f47.google.com ([209.85.219.47]:60858) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyJdM-0002OB-Rf for emacs-orgmode@gnu.org; Thu, 24 Jan 2013 05:02:12 -0500 Received: by mail-oa0-f47.google.com with SMTP id h1so9708726oag.34 for ; Thu, 24 Jan 2013 02:02:11 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --bcaec54a35d49199ed04d405e7c9 Content-Type: text/plain; charset=ISO-8859-1 I want to use org-mode for data analysis for my results. I also want to do this using small chunks of code blocks for various task. To achieve that. I need to pass dictionaries (20 entries of lists, each of several hundreds variables, each is a list by itself). I wanted to do so by the #+CALL option for example: * test #+NAME:test #+BEGIN_SRC python vars = dict() vars[1] = 1 vars[2] = 2 return vars #+END_SRC * caller #+NAME: caller #+HEADER: :var ins=#+CALL: test() #+BEGIN_SRC python :results output print files #+END_SRC But I get an error: File "", line 1 files=[1:, 1, 2:, 2] ^ SyntaxError: invalid syntax Is there a way to pass a dictionary as a variables between blocks then? -- My other email account has a "professional" signature. --bcaec54a35d49199ed04d405e7c9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I want to use org-mode for data analysis for my results. I= also want to do this using small chunks of code blocks for various task. T= o achieve that. I need to pass dictionaries (20=A0entries of lists, each of= several hundreds variables, each is a list by itself). I wanted to do so b= y the #+CALL option for example:


* test=A0
=A0 #+NAME:test
=A0 #+BEGIN_SRC python
=A0 =A0 vars =3D dict()
= =A0 =A0 vars[1] =3D 1
=A0 =A0 vars[2] =3D 2
=A0 =A0 ret= urn vars
=A0 =A0=A0
=A0 #+END_SRC

* caller
=A0 #+NAME: = caller
=A0 #+HEADER: :var ins=3D#+CALL: test()
=A0 #+BE= GIN_SRC python :results output
=A0 =A0 print files
=A0 = =A0=A0
=A0 #+END_SRC

But I get an error:
=
=A0 File "<stdin>", line 1
= =A0 =A0 files=3D[1:, 1, 2:, 2]
=A0 =A0 =A0 =A0 =A0 =A0 ^
SyntaxError: invalid syntax

Is there a way to pass a=A0dictionary as a variab= les between blocks then?=A0



--
My other email account has a "professional&q= uot; signature.
--bcaec54a35d49199ed04d405e7c9--