GNU bug report logs -
#50057
27.2; Issue evaluating Python code across machines
Previous Next
Reported by: Augusto Stoffel <arstoffel <at> gmail.com>
Date: Sat, 14 Aug 2021 16:02:02 UTC
Severity: normal
Found in version 27.2
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50057 in the body.
You can then email your comments to 50057 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50057
; Package
emacs
.
(Sat, 14 Aug 2021 16:02:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Augusto Stoffel <arstoffel <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 14 Aug 2021 16:02:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Suppose the current buffer is editing a local file and you would like to
evaluate some code on a Python inferior running in a remote machine.
The following should work:
(let ((default-directory "/ssh:some-remote-machine:/"))
(run-python))
(python-shell-send-string "5+5")
(python-shell-send-string "(5\n+5)")
The first python-shell-send-string call indeed works. The second one
produces an error, because a temporary file is created in the local
machine instead of the remote one. The same kind of error happens if
one tries to evaluate the region on the entire buffer.
I've attached a small patch to fix this.
[0001-Allow-evaluating-Python-code-across-machines.patch (text/x-patch, inline)]
From b3f47f99da7b8ac2221b6bbafc85ae8076f92703 Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel <at> gmail.com>
Date: Sat, 14 Aug 2021 17:48:45 +0200
Subject: [PATCH] Allow evaluating Python code across machines
* python.el (python-shell-send-string): Ensure that the temporary file
is created in the host running the Python process.
---
lisp/progmodes/python.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 2557704e40..20299c20d2 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -3085,7 +3085,8 @@ python-shell-send-string
(list (read-string "Python command: ") nil t))
(let ((process (or process (python-shell-get-process-or-error msg))))
(if (string-match ".\n+." string) ;Multiline.
- (let* ((temp-file-name (python-shell--save-temp-file string))
+ (let* ((temp-file-name (with-current-buffer (process-buffer process)
+ (python-shell--save-temp-file string)))
(file-name (or (buffer-file-name) temp-file-name)))
(python-shell-send-file file-name process temp-file-name t))
(comint-send-string process string)
--
2.31.1
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#50057
; Package
emacs
.
(Sun, 15 Aug 2021 12:02:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 50057 <at> debbugs.gnu.org (full text, mbox):
Augusto Stoffel <arstoffel <at> gmail.com> writes:
> The first python-shell-send-string call indeed works. The second one
> produces an error, because a temporary file is created in the local
> machine instead of the remote one. The same kind of error happens if
> one tries to evaluate the region on the entire buffer.
>
> I've attached a small patch to fix this.
Thanks; applied to Emacs 28.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug marked as fixed in version 28.1, send any further explanations to
50057 <at> debbugs.gnu.org and Augusto Stoffel <arstoffel <at> gmail.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sun, 15 Aug 2021 12:02:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 13 Sep 2021 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 279 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.