From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 1A9GA0uhPWEz/wAAgWs5BA (envelope-from ) for ; Sun, 12 Sep 2021 08:42:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id KB0cOkqhPWEALQAA1q6Kng (envelope-from ) for ; Sun, 12 Sep 2021 06:42:18 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 543578813 for ; Sun, 12 Sep 2021 08:42:18 +0200 (CEST) Received: from localhost ([::1]:42382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPJBw-0006fa-DP for larch@yhetil.org; Sun, 12 Sep 2021 02:42:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53718) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPJBZ-0006fP-S4 for emacs-orgmode@gnu.org; Sun, 12 Sep 2021 02:41:53 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:35518) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPJBY-0003ke-9A for emacs-orgmode@gnu.org; Sun, 12 Sep 2021 02:41:53 -0400 Received: by mail-wr1-x429.google.com with SMTP id i23so9295744wrb.2 for ; Sat, 11 Sep 2021 23:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version; bh=Bv5xBj1WCz84ZAyCsO5MDjeCfCNRFnWdHKYkLnjxXBs=; b=q4QwvtrQMc21ffKnUhKzbhMauBvyls/6av4GxS5DlV9mCap8ektUK7R0ZjHSY0YrU8 +yHiXp9CRkK0KZvSfFMHG5gj6tMGKBcOuHiIMD9WjG1p6YUAbhJmbNYeJSNjyvwBHzlQ GhhEiF4EsDOzyPRlkbNWo4I6SEW/0sx8PYj6si2Nftc0ZuJ9QPQxfKoWZbwjOznqILlP diEewVDkQRjnKFOEwoDXWTm3goCYvkbdj2dz6FtPfiYYA4S9PbrsXbYKlSRfxlEujf7N CucQsPFuB0zpVdm/+0S42Mk42GDc+5J81SR6iYbyA9CTJLP16cuCfbve8aeVhbJDOkA2 RuDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=Bv5xBj1WCz84ZAyCsO5MDjeCfCNRFnWdHKYkLnjxXBs=; b=SRyTvrcNWSlLNduwn5GWuYKu33dUyRtXGUKh4UxVvZJf7jicm7IndDSKNZ71V0EORO exqRuFDSBttnIsZS21rc+8JqLIXEMnpdTq7hE5NrCAaIyACLfHyo1izdCo4biQqmuTFn SiCN0rEP22LZDnddeplVvASuWkTBt8IU5WJ6uUnMgCH1ZYVweEevz3wKRijRj3IN5pzX FZeRjfeCauFEw8S8M7yVb7K5LJMxXMbNyNCUz/ieRqzPaC4efO090dQeaegCeu3SrLAx EEW8YoiDxeIUgZXuVmFwcqblg66UA4jQKyCpCJMtfYOlFkaa4SUQ759B0nbJ2DW5INmg 3zqQ== X-Gm-Message-State: AOAM533uyDz9UYdcy5RbkdFiKzK1II7/bwKmpShqHAJYH/FKT9MID/K7 2Wc2mcFebSja4tRrHofGW6j0vlNhF/Vj+A== X-Google-Smtp-Source: ABdhPJzGQS2ZLLvQCcLMBEXck6bm+I3rY/dJHdFxs3C/2PK6pSW6abRiHaJvxFs4eHV6T3Gycp4HZg== X-Received: by 2002:adf:e745:: with SMTP id c5mr6106911wrn.321.1631428909575; Sat, 11 Sep 2021 23:41:49 -0700 (PDT) Received: from ars3 ([2a02:8109:8ac0:56d0::b1d]) by smtp.gmail.com with ESMTPSA id q7sm3630153wrc.55.2021.09.11.23.41.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Sep 2021 23:41:49 -0700 (PDT) From: Augusto Stoffel 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 Message-ID: <875yv61ej9.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=arstoffel@gmail.com; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1631428938; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Bv5xBj1WCz84ZAyCsO5MDjeCfCNRFnWdHKYkLnjxXBs=; b=Y/Zuld+B0Hl6HYW3wSWyu/Eqx5x/Tqw1IgxG8vx9/IuEgvwSu40nWIjIGmKWN0zB+mgs8U 54EWUWuAx7uMSWeJ66Y6ooNp297nEw4n/zZ1Gp76Mq8lq+yEpduQ0y1y/RtTstdYLCwe8m 2XNRm+/6pbyY8TBw6X3lSMl10Oy5tIqbXkoiM6KSIy1ZoQAhI8L1F0YU/f5j4TRl7OPgGz d2nJLs5Uk8Sxev4FDC+9opsg8SZ2LjUpdsXtlra7I+K2LNmQQyPyzoJinoj41ojLZyTWG2 i+KZtLt6Kt4GyOzqDQsdDbqtw+EIoFCHKglyCAYzYnQadBgkxlZOmwQ8R+AwOg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1631428938; a=rsa-sha256; cv=none; b=NeXSKKUO7QA8oNqDd6e55+1U7PIaljLUR4M0aSM7zmIcwpkV336jgARp7etNU/Vu69IaF7 0H33Eg10cOXW6lCbnCeC3KOnj/koXMA58XperuznRllR+533tIWpdKc7g88Od3ysPW7CeH MeOJ8OhAs+TfQBZ3FhqtottYm+X4zLF0pzGl6HtCe5sFZKdhtLr81EzrC7LTCXPCF/1KV9 uzAYWFH7k1GUrnOZt4RUW4eZQKkADmvi2oeSIK3YKe0t4ol56lFRm5gpfYCFymdwfLjmka bryY/aYHEsuHiZZhE9Fatald0ul11mwUtX8a4t1CdljpfJk0eWVYkif92fukHg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=q4QwvtrQ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.11 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=q4QwvtrQ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 543578813 X-Spam-Score: -3.11 X-Migadu-Scanner: scn0.migadu.com X-TUID: 0OXNToBl6IQK --=-=-= Content-Type: text/plain 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.) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=ob-python.diff 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) --=-=-=--