Hi all. I often need to run some code on a remote ssh session, because
only there I can access a database and the environment is hard to
replicate, while I want to keep the code I run on my local machine.

The remote session is initialised with run-python after I change
default-directory and use pythonic-activate. Sending commands from a
local python buffer using python.el works without issues. It would be nice
if I can do
the same from a local org-mode buffer from a python source block.

It does not work because org-babel-python-evaluate-session has two
org-babel-temp-file commands that run in the context of the local
buffer. If I replace them with
(let* ((tmp-src-file (with-current-buffer session (org-babel-temp-file
"python-"))) ...) ...)
and
(let* ((tmp-results-file (with-current-buffer session
(org-babel-temp-file "python-"))) ...) ...)
then executing the code works again. I have also changed similarly
org-babel-python-async-evaluate-session
although I haven't tested async.

I am hoping this is a change worth making at source, or maybe there is
a better way to achieve the same.

Thank you.


Emacs  : GNU Emacs 28.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version
3.24.20, cairo version 1.16.0)
 of 2022-06-24
Package: Org mode version 9.5.4 (9.5.4-ge0b05b @
/home/moutsopoulosg/.emacs.d/elpa/org-9.5.4/)

Reply via email to