emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Augusto Stoffel <arstoffel@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Bug: ob-python issue in Emacs 28 [9.4.4]
Date: Sun, 12 Sep 2021 08:41:46 +0200	[thread overview]
Message-ID: <875yv61ej9.fsf@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 622 bytes --]

In Emacs 28, `python-shell-send-string' prints an additional newline
between the prompt and output (among other things, so you can tell
whether or not the inferior process is busy at any given time).

However, this interferes with ob-python, see e.g.
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=50514

The attached patch indicates how to solve the problem.  As a permanent
solution, I would suggest to replace org-babel-chomp and actually strip
whitespace from both ends of the string outputted from the Python
interpreter.  (IPython even has a configuration option to add extra
whitespace before or after the output.)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ob-python.diff --]
[-- Type: text/x-patch, Size: 577 bytes --]

diff --git a/lisp/org/ob-python.el b/lisp/org/ob-python.el
index 7911205d08..e3714964b7 100644
--- a/lisp/org/ob-python.el
+++ b/lisp/org/ob-python.el
@@ -352,7 +352,7 @@ org-babel-python--send-string
 		   org-babel-python-eoe-indicator
 		   string-buffer))
 	(accept-process-output (get-buffer-process (current-buffer))))
-      (org-babel-chomp (substring string-buffer 0 (match-beginning 0))))))
+      (org-babel-chomp (substring string-buffer 1 (match-beginning 0))))))
 
 (defun org-babel-python-evaluate-session
     (session body &optional result-type result-params)

             reply	other threads:[~2021-09-12  6:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-12  6:41 Augusto Stoffel [this message]
2021-09-14  5:56 ` Bug: ob-python issue in Emacs 28 [9.4.4] Jack Kamm
2021-09-14 19:40   ` Augusto Stoffel

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=875yv61ej9.fsf@gmail.com \
    --to=arstoffel@gmail.com \
    --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).