[Top][All Lists]

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

Re: org-babel guile source block bug in handling multiple values

From: Zelphir Kaltstahl
Subject: Re: org-babel guile source block bug in handling multiple values
Date: Fri, 10 Mar 2023 10:42:17 +0000

On 3/9/23 14:10, Ihor Radchenko wrote:
Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes:

#+name: python-imports
#+begin_src python :python /usr/bin/python3 :results output replace drawer :var 
import math

y = math.sqrt(x)
# print(y)

#+name: python-usage
#+begin_src python :python /usr/bin/python3 :return :noweb strip-export 
:results value replace drawer

print("y: {}".format(y))

Unfortunately, this example does not seem to work at all, but for a different

It seems that using any Python source block with :var header args via :noweb
does not work, as it then behaves in the way, that it merely pasted the included
source block, without first putting in the :var values into the variables. I get
errors about those :var variables being undefined, of course, since they are on
the included source block, not on the including one:

~~~~START: *Org-Babel Error Output*~~~~
Traceback (most recent call last):
    File "<stdin>", line 10, in <module>
    File "<stdin>", line 5, in main
NameError: name 'x' is not defined
[ Babel evaluation exited with code 1 ]
This is expected. Noweb includes the src block code without altering it.
See 16.11 Noweb Reference Syntax

We may probably clarify this in the manual. Would it be helpful?
I think it would be helpful. I merely tried Python, because it was at hand and because I did not find ob-racket in M-x package-list RET and did not have another Scheme installed. Cannot say, whether others find the behavior confusing or not, but I imagine I would find it helpful, if it was mentioned in the docs.

repositories: https://notabug.org/ZelphirKaltstahl

reply via email to

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