emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org-sbe: error when passing strings as parameters to/from Python


From: Karl Voit
Subject: Re: [O] org-sbe: error when passing strings as parameters to/from Python blocks
Date: Thu, 14 Mar 2019 16:37:41 +0100
User-agent: slrn/pre1.0.0-18 (Linux)

* Karl Voit <address@hidden> wrote:
>
> * Daniel Herzig <address@hidden> wrote:
>> Karl Voit <address@hidden> 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/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]