From mboxrd@z Thu Jan 1 00:00:00 1970 From: Karl Voit Subject: Re: org-sbe: error when passing strings as parameters to/from Python blocks Date: Thu, 14 Mar 2019 16:37:41 +0100 Message-ID: <2019-03-14T16-34-51@devnull.Karl-Voit.at> References: <2019-03-14T09-43-42@devnull.Karl-Voit.at> <2019-03-14T13-20-02@devnull.Karl-Voit.at> Reply-To: Karl Voit Return-path: Received: from eggs.gnu.org ([209.51.188.92]:50573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h4SQe-0002pn-3b for emacs-orgmode@gnu.org; Thu, 14 Mar 2019 11:37:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h4SQc-0001fI-6v for emacs-orgmode@gnu.org; Thu, 14 Mar 2019 11:37:56 -0400 Received: from [195.159.176.226] (port=53412 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h4SQa-0001dd-4z for emacs-orgmode@gnu.org; Thu, 14 Mar 2019 11:37:54 -0400 Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1h4SQX-00170Y-Ao for emacs-orgmode@gnu.org; Thu, 14 Mar 2019 16:37:49 +0100 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" To: emacs-orgmode@gnu.org * Karl Voit wrote: > > * Daniel Herzig wrote: >> Karl Voit writes: >> >> After some trying I found that the variables as set in the source-code >> header need standard values set: >> >> #+NAME: classificationfm >> #+BEGIN_SRC python :var prob="high" :var impact="high" >> if prob == "high" and impact == "high": >> return "A" >> if prob == "low" and impact == "high": >> return "B" >> if prob == "high" and impact == "low": >> return "C" >> if prob == "low" and impact == "low": >> return "D" >> #+END_SRC >> >> If I don't set them I get exactly the same errors as you. Like this I >> get the following: >> >>| prob | impact | class | >>|------+--------+-------| >>| high | high | A | >>| low | high | B | >>| high | low | C | >>| low | low | D | >> #+TBLFM: @2$3..@>$3='(org-sbe classificationfm (prob $$1) (impact $$2)) >> >> Evaluation is being asked for each line then. > > Thanks for the workaround to circumvent the bug. Now, it's working > with my older Org as well. > > Is somebody fixing the bug in Org as well? (Or adding a statement to > the manual?) On reddit[1] loskutak-the-ptak pointed out that the manual states that the default value is not optional: [2] So it is not a bug and it was my own fault from the start. Default values might be omitted for non-string parameters but it is not backed by the documentation. [1] https://www.reddit.com/r/orgmode/comments/b0ll1v/embedding_python_code_in_table_formula/ [2] https://orgmode.org/manual/var.html -- get mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML into Org-mode: > get Memacs from https://github.com/novoid/Memacs < Personal Information Management > http://Karl-Voit.at/tags/pim/ Emacs-related > http://Karl-Voit.at/tags/emacs/