emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Changing the environment before calling source block?


From: Ihor Radchenko
Subject: Re: Changing the environment before calling source block?
Date: Sun, 03 Oct 2021 14:55:06 +0800

"Loris Bennett" <loris.bennett@fu-berlin.de> writes:

> Hi,
>
> I have multiple versions of each of various languages such as Python
> or R.  On the command line I can select a version using the 'module'[1]
> mechanism provided by Lmod[2]:
>
> My question is: How do I change the environment, ideally call 'module
> load ...' but potentially just set environment variables, before calling
> a source block?

It depends on source block language.  For Python, there is :python
header arg where you can specify python command to be used.  I am not
sure about R

More generally, you can advice org-babel-execute-src-block and wrap it
into something like with-environment-variables macro (available in
newest Emacs).

Or you can write a bash source block, set envitonment there as usual,
and invoke your Python/R script using noweb.

Hope it helps.

Best,
Ihor



reply via email to

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