From: Christian Vanderwall <christian@cvdub.net>
To: emacs-orgmode@gnu.org
Subject: [PATCH] ob-python.el: Fix issue with sessions on remote machines
Date: Mon, 17 Aug 2020 11:47:38 -0700 [thread overview]
Message-ID: <87h7t16red.fsf@pc.i-did-not-set--mail-host-address--so-tickle-me> (raw)
[-- Attachment #1: Type: text/plain, Size: 518 bytes --]
The function `org-babel-python-evaluate-session' doesn't process temp
file names with `org-babel-process-file-name' before inserting them into
the Python code blocks. This causes a 'No such file' error when the
executing the code blocks on a remote directory.
The attached patch fixes this issue, allowing compilation of Python
source blocks with a remote directory, such as :dir /ssh:user@server:/.
This is my first patch ever, so please let me know if there's ways I can
improve.
Thanks!
--
Christian Vanderwall
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-python.el-Fix-issue-with-sessions-on-remote-machi.patch --]
[-- Type: text/x-patch, Size: 1626 bytes --]
From 7cf3d4c53e12addced7d2f65de1632971f44f056 Mon Sep 17 00:00:00 2001
From: Christian Vanderwall <christian@cvdub.net>
Date: Tue, 11 Aug 2020 20:26:39 -0700
Subject: [PATCH] ob-python.el: Fix issue with sessions on remote machines
* lisp/ob-python.el (org-babel-python-evaluate-session): Process
temporary file name with `org-babel-process-file-name' before
inserting it into code Python code snippets.
Before this change, the entire temporary filename was sent to the
Python session for execution, causing a 'No such file' error when the
filename had a Tramp format such as
/ssh:user@server:/tmp/python-ABCDEF.
TINYCHANGE
---
lisp/ob-python.el | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index 69312f2c9..0e3c79522 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -335,7 +335,8 @@ last statement in BODY, as elisp."
"python-")))
(with-temp-file tmp-src-file (insert body))
(format org-babel-python--exec-tmpfile
- tmp-src-file))
+ (org-babel-process-file-name
+ tmp-src-file 'noquote)))
body)))
(mapconcat
#'org-trim
@@ -353,7 +354,8 @@ last statement in BODY, as elisp."
"python-")))
(with-temp-file tmp-src-file (insert body))
(format org-babel-python--eval-ast
- tmp-src-file))))
+ (org-babel-process-file-name
+ tmp-src-file 'noquote)))))
(org-babel-comint-with-output
(session org-babel-python-eoe-indicator nil body)
(let ((comint-process-echoes nil))
--
2.28.0
next reply other threads:[~2020-08-17 18:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-17 18:47 Christian Vanderwall [this message]
2020-08-18 14:21 ` [PATCH] ob-python.el: Fix issue with sessions on remote machines Jack Kamm
2020-08-21 1:37 ` Jack Kamm
2020-09-04 9:55 ` Bastien
2020-09-05 1:08 ` Jack Kamm
2020-09-05 8:15 ` Bastien
2020-09-05 14:39 ` Jack Kamm
2020-09-05 14:48 ` Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h7t16red.fsf@pc.i-did-not-set--mail-host-address--so-tickle-me \
--to=christian@cvdub.net \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).