From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 0L0pApDLCmOCOQAAbAwnHQ (envelope-from ) for ; Sun, 28 Aug 2022 03:57:36 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id IJg7ApDLCmPyQwEAauVa8A (envelope-from ) for ; Sun, 28 Aug 2022 03:57:36 +0200 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 8F62832DFC for ; Sun, 28 Aug 2022 03:57:34 +0200 (CEST) Received: from localhost ([::1]:57456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oS7YL-00080z-As for larch@yhetil.org; Sat, 27 Aug 2022 21:57:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oS7Xr-00080p-31 for emacs-orgmode@gnu.org; Sat, 27 Aug 2022 21:57:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39389) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oS7Xq-0000Sb-Qe for emacs-orgmode@gnu.org; Sat, 27 Aug 2022 21:57:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oS7Xq-00048s-JO for emacs-orgmode@gnu.org; Sat, 27 Aug 2022 21:57:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#50514: 28.0.50; org inline call to python src block req C-g to break Resent-From: "Barton, Mark" Original-Sender: "Debbugs-submit" Resent-CC: emacs-orgmode@gnu.org Resent-Date: Sun, 28 Aug 2022 01:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50514 X-GNU-PR-Package: org-mode X-GNU-PR-Keywords: To: Ihor Radchenko Cc: "50514@debbugs.gnu.org" <50514@debbugs.gnu.org>, Lars Ingebrigtsen , Augusto Stoffel Received: via spool by 50514-submit@debbugs.gnu.org id=B50514.166165179315888 (code B ref 50514); Sun, 28 Aug 2022 01:57:02 +0000 Received: (at 50514) by debbugs.gnu.org; 28 Aug 2022 01:56:33 +0000 Received: from localhost ([127.0.0.1]:57371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oS7XK-000489-8X for submit@debbugs.gnu.org; Sat, 27 Aug 2022 21:56:33 -0400 Received: from mail-mw2nam04on2103.outbound.protection.outlook.com ([40.107.101.103]:34145 helo=NAM04-MW2-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oS7XE-00047s-5h for 50514@debbugs.gnu.org; Sat, 27 Aug 2022 21:56:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FWU8VJ5IEYumdDdFVDRQMhb8dQTyIQ5DI9bF4TZUAQoA3QB/ygJ9ukr9XTFxvbHoERfMGRza1Tq5Vs4xVG1YmjvDSd4Vp5kaUDKsNGT+uinbSEsEIxn12obv0ZKCbhK4Z9aSEYPkQvPyjnSEI9vq5clvD/huZhS40jgCbqkioj1HFWu2Kbn3yAcqEaI55Aw75tiIAkHUwMm1jFTBbFltVvDqqn7l9LcrhHMZbJ/WjjM2RPd4looMukjXJJSm9HejYJUq65I0umwYKJo66EdFMSDapFe8Kjg/SSVEE16gMok7PMNdQAJ6C3o9zD4aqFkjGStuysFjkjz+ZllbOvok1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=J9gTOukm8EvbRqAPWheSh1c6HmT6Gg66YSGIymCZbFI=; b=kjQ6ruEKGCSEPM2wlEi6MccsCcDvP+wivz0uhAuKRXYwE/c28pDXBSo+k4tuYs3L8J2RIhAYc8ztzGidTxAltvt4h2esAmdLIEbCrEz0ifuLOO9vMNH3axsshKygmVdXwNUdi824xS3/Gs75/WcbfsgSvVd5wtZyCMXFN6PF8U/4Q+eTegvRVMfbelKAU6vNNfErV0wOhc0rN1JTvBW2MSO0o4yBTliJA0iBaJNgBkTnm92A7yLR9AE0/RSgG8518MNpynvC8YZdXhJd1ynYMVO89vOwJ0sULOd5wCyD4Y/d6MifZP3C0hLHrXlRmUvCoL1NZqPvMNAXBxN20gg8+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=disney.com; dmarc=pass action=none header.from=disney.com; dkim=pass header.d=disney.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=twdc.onmicrosoft.com; s=selector2-twdc-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J9gTOukm8EvbRqAPWheSh1c6HmT6Gg66YSGIymCZbFI=; b=MAMNfgBNR0XTdUPf/TrrfUMBe7cdug8sMdqh5pBiXO0oACWQ6Wsp96MQhL2GxujoY0ma3YYCNByy2H2tMq8dl3re0NMMcGrEcCiZIaFwZvSURC+m/WoTecMOaGspJ/AS9oFBH9RKiYoD1q7f7zKEe0hmjYhn1GFuUoYR4l/mcwQ= Received: from SJ0PR03MB6501.namprd03.prod.outlook.com (2603:10b6:a03:386::18) by DM6PR03MB5034.namprd03.prod.outlook.com (2603:10b6:5:1ec::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.19; Sun, 28 Aug 2022 01:56:14 +0000 Received: from SJ0PR03MB6501.namprd03.prod.outlook.com ([fe80::39c2:2acb:4607:daaf]) by SJ0PR03MB6501.namprd03.prod.outlook.com ([fe80::39c2:2acb:4607:daaf%8]) with mapi id 15.20.5566.015; Sun, 28 Aug 2022 01:56:14 +0000 From: "Barton, Mark" Thread-Topic: bug#50514: 28.0.50; org inline call to python src block req C-g to break Thread-Index: AQHYuJUcra94FftNmEeOPokxU5Hjm63BLvaAgAGOeMiAAA8mgIAAT80AgAArNoCAADQsgIAADo0AgAAHOYA= Date: Sun, 28 Aug 2022 01:56:13 +0000 Message-ID: <0324EA8C-CB50-473E-A106-68DA2437C90E@disney.com> References: <9CADADD8-72C0-4951-9950-AC7149B339F4@gmail.com> <56BAC174-35F5-4ED6-8923-729B2DE20490@disney.com> <87czclduj5.fsf@localhost> In-Reply-To: <87czclduj5.fsf@localhost> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.3696.120.41.1.1) x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2ea66958-cc73-40c4-a6c0-08da88987cf5 x-ms-traffictypediagnostic: DM6PR03MB5034:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /ZqLczxhstJaI2+ipNo45eoR2nMUu9+xspIxREq+Bo8Kru9IaAoK/OqXePMpmNo8bjSgma/6X82hpO61f5GxnXV7OoipMo+1ix7ujGwSH5giiw2wzAOqZRvRXpoC3aaSOiCsKLqY6n/S6kG6YpEb7zOQG/Z0bkWRRdT+kPGNSP3BCg5igl2MUOByQdVwDTjXgV1N0sb4BdjyuK5SXyeLY/+W6wGydMK79H8lE+4c0seHGKZuBz2imwxdKJrd2ZH3Mewre7MRFO7I7ce5/KFxbuyXevqUGZOyDMLYWeUptg3HpAvr6XwEsP/qweEDor0EsBkqJyLxxAQ+1bXxgZelHhBRBLixzZb03eWALG0BiDr3SqCQI52P65ffB4/xdGGPXraH7KdIe94SaDTOJF9qcLTGbGCpU26CBvNiJ5VFcLsDTksQp06lKC1zaA7nis++9SUaVRraTm2lXp6+h2hZu3IUMI5ZuY2vtolIh42DA8ph7VQC0dOT5GVhfW/BrnwzOy6/RbfTgLCBKUniaze5cckXHiwWPjen3E0JpITkccItAcunEGB8muz0lsK0EBKgXpGXqGyV42lOSgrXM4mVUjKf3WMn6hAkTEbaDUEbI2Rgikslc/6zdr9UMnJ0I0NV4gPVBB6zrqn4ULuzBavfb490NIkUSeWbV0mQbjcpRIBhZaxCQmKfuV9bzjbleFTVP4fNv9RWG0yCc5pCyxGQ87kdOmXXFMRnyl9vZ+jcgoMJ+/3VEaBa21+e57eCTQvnxAoNNazvPy6WGaIi3Ec8IQsKMdco02/EO2k04oLiYo8= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR03MB6501.namprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(136003)(376002)(39860400002)(346002)(396003)(366004)(6512007)(2616005)(478600001)(41300700001)(83380400001)(8936002)(186003)(71200400001)(2906002)(6506007)(53546011)(5660300002)(316002)(6486002)(66446008)(8676002)(54906003)(122000001)(66476007)(82960400001)(6916009)(64756008)(66556008)(86362001)(4326008)(66946007)(38100700002)(33656002)(38070700005)(36756003)(76116006)(45980500001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: JSxlZ2tvAr9Ez8pp/RczXI+Q6fLzlgL228YZHlIN9el1ecYvGSzYWeTgLc7Imve8umAN8Dk8XNPWnlpBBP4Exuj5Y4aFsDc7l0hoL0dZYpsOWJtdndGPhi3fUkJlRf09rjpKF1vgeO71oq5zrI8EXdbXMMWGGRWxkMEoa15IhuVgB3YQaZlwOgKFqeMotLMZ4MeLcMJIsMzg8QAWJQz6sFTEFVA6yU076JRwxl94ZwYnlbFj9Gsj02WtbkY1cRyHCKFJR4rIsyP/kWtZgWwSdK0XcTsmxk5O71jwPSYkvrJcodI3CWfhQ5ob7Hcfosfcgz6myufKrQ5OpzENpTjbugNHM0xaziK+Tyyr6QGCKOuTKQ66SBf0yKX9MOz5N2LbO+DseBR/aUL4ALOt299GkXUDVczXkgNtQ5l/t/RI/hnnxWcg5N35KX6a8/pRoiNqS4QBA//sQ2FCXPhWsAqy63192sPkQqsgxRxGMmgTbYgLGCcRN/aRv6TnjSAU5l0rf7V/pLyU5B21r90m1V0YEX3OfmTAUIjYJ9EpA7bBomUKhJjyAGh995D0PGuXGSR9kd4tHoViMIPUzj3tgBDsj8+055+/z4UudG7uqGMXTCpjeIbgJqlkCiw3O3SWY6bN+yVULV2WtFgtQYQCXlY4aq0BY3LHjycP2IE+a1DlDIS9fsudXvKNjIp9luswPKQf6aVl819+8+8kdhmdoTVt7ICBDXGbACnUYnQdZzLqHhQgobJNdkulx9MFqqk9ll3+bkvfYNm7EROQqW53EL2zSjjCQewBAAnlpXrvByHDvVOVRydtL6N3psse+7AKUtRYPCv46eEf42IvuyIl92vJSP8LwqWHT2TyzO3ZZs+eLfOt6rReihodqZXET4cYz1LSfD9oneT69iU8hRdKUXQCaejVLia4iAE69nitihNcsGzYPYggBApaNob14Of9TRsd HUHXqSdtNBKnk3aY1OaQfgg5b7yp+lc2Pj2aPjAK8wM11qwFQ3yO/X0RCxFaDgn7AvyyEyIUgAVU6SB/l9t6Y3BY6XtC2Z0awReS5coCyp0W+oNJ47A9D+1ahKXhZ2LnMzi+ABrbMf/P+98zMGIHd/5l4whfKsPsS3OzGBnTGme8pvf22PmQKW9bxDVFXm97XWzf2Oy0RDviEHvhAwK2IUUVhbdpfhG1eOhaGWrO+kCjw8N17VKIMLDW065DIRpi6TdR+tWPNBQjTXLOyS710ii2UUh5bNKKlbdBlo59/exe0DSjxjMv9x5k3b1qSZ7XYbkBw3w5tWVP1LyddrtjqVF8/eUMFP6Nfb+g8OfzluA0MzUuGXu9m0Mr08rDmG9Q55F+RHjBHiVVxKz3IvMQtkYT6Hja36Y2kmDazHr1f2LVyWUu5sB2QULu51S3biwWZxZNIPwrqXoNSAIbf+ma6VKkA49KI2uJ4BD0xTISHRlV0N5zsyD72f47CR8lYgvllJDTr0tv5lvrCjQvj4dYc/lVUlKQd0JXBchAR3zJTaSXwn5VLljUn1buWof69EIFVHwzLwMJ9TMhFizy2TNJju+6gpxP6ZMRP9OQmcGDZIZdLP8B4ZQxzmLuhw7kEK9nZ0og3J6qUjBnx6fPZZRDvVgPxf0AmOwtZJOz9gPi6nGnSL1noEvVgV+fMG0Uhw0jf4yOXAzty/oQGnR7BSLMxg== Content-Type: multipart/alternative; boundary="_000_0324EA8CCB50473EA10668DA2437C90Edisneycom_" MIME-Version: 1.0 X-OriginatorOrg: disney.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR03MB6501.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ea66958-cc73-40c4-a6c0-08da88987cf5 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Aug 2022 01:56:13.9070 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 56b731a8-a2ac-4c32-bf6b-616810e913c6 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 6y0ZtKJiJXKl1j7WM67pvDsILjM28EzbF3umZoJrUdLr1fciGazD9wwNRc+L+JEA3ITDA7tXtymH6zUHU4ADwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB5034 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: emacs-orgmode@gnu.org 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 X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1661651855; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=J9gTOukm8EvbRqAPWheSh1c6HmT6Gg66YSGIymCZbFI=; b=QibdtvP58qFYv5ax3cfwnBZlJ0P/TMEp2uMnWDDAcEr3pqNMR8EQrDLWcIdjHX6DrYDvc+ W35oqYru95wMCKEj0oBl0kfEoeLyY053AuL6FatEGMkMvfoPGzfF+GgyCLOXXLR0kOxuoc 9qpA5xxT8kM++Sl7Ma9WJH2X+7UwVqNLha2LiZ1DnlEBPDfaO7Sb1fSg9y5NbC/ZmXo4BV EEoIlPbGhtC6p59/5r8ulfJd1tklW7Y9sQnDeQ8oDQHlr2+JjcHei01hDkzqmSlmMxhkDe EOYfaAv0gwGHNViQ12Q66hWyqPfvKEPVUFaIulZZh158NVmcf85r0Ro4FPnDMA== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1661651855; a=rsa-sha256; cv=fail; b=frxGgUPR6dhoY70fngGtsPYEvevpNc2JFS4Po30ZpCFhNcmpg+XdKc0f2tQFjE8TykJHMh AgQA5mWCkmOXDgmQYd5zJmTpLuEAVgNrxWtmyRaKfKcFNgc3IZlkEXE/xDAUe6fYdeECJE YoG5TBDBP22r03HIqJyXY6pL1bc+R2wh/u6/J01H0hQon36V4Ew58RzUQ5rEzGZzF7xR6t wWzv8t45Gw+enKNGWsgdKipS4tlVSdhFkAecSMaNUSGz9H7pjxmxupRDF2zUefZJd48cSx lb+i3etzZTeiNlzm3n0WI5qjh4izCvDSzBMJ6NCntGzfsoJl5TiwSm7jaH+IDQ== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=twdc.onmicrosoft.com header.s=selector2-twdc-onmicrosoft-com header.b=MAMNfgBN; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=fail reason="SPF not aligned (relaxed)" header.from=disney.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 8.70 X-Spam: Yes Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=twdc.onmicrosoft.com header.s=selector2-twdc-onmicrosoft-com header.b=MAMNfgBN; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=fail reason="SPF not aligned (relaxed)" header.from=disney.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 8F62832DFC X-Spam-Score: 8.70 X-Migadu-Spam: Yes X-Migadu-Scanner: scn1.migadu.com X-TUID: aBZEtHzTKamp --_000_0324EA8CCB50473EA10668DA2437C90Edisneycom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On Aug 27, 2022, at 6:30 PM, Ihor Radchenko > wrote: * lisp/ob-python.el (org-babel-python-initiate-session-by-key): Do not rely on 10ms delay to initialize Python. Wait until python process is initialized using `org-babel-comint-wait-for-output'. --- lisp/ob-python.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/ob-python.el b/lisp/ob-python.el index 932aca08e..e50a7c2e2 100644 --- a/lisp/ob-python.el +++ b/lisp/ob-python.el @@ -197,8 +197,7 @@ (defun org-babel-python-initiate-session-by-key (&optio= nal session) (setq py-buffer (org-babel-python-with-earmuffs session))) (let ((python-shell-buffer-name (org-babel-python-without-earmuffs py-buffer))) - (run-python cmd) - (sleep-for 0 10))) + (run-python cmd))) ((and (eq 'python-mode org-babel-python-mode) (fboundp 'py-shell)) ; python-mode.el (require 'python-mode) @@ -217,6 +216,8 @@ (defun org-babel-python-initiate-session-by-key (&optio= nal session) (py-shell nil nil t org-babel-python-command py-buffer nil nil t nil))) (t (error "No function available for running an inferior Python"))) + ;; Wait until Python initializes. + (org-babel-comint-wait-for-output py-buffer) (setq org-babel-python-buffers (cons (cons session py-buffer) (assq-delete-all session org-babel-python-buffers))) -- 2.35.1 That works for me. I'm using a series of python blocks to create org tables= to be inserted in specific places in the document. So each block is named = for that reason. Do we need to worry about the note about not appropriate for large blocks o= f code or does that not apply in this case with the way you implemented it. (org-babel-comint-wait-for-output BUFFER) Wait until output arrives from BUFFER. Note: this is only safe when waiting for the result of a single statement (not large blocks of code). Mark --_000_0324EA8CCB50473EA10668DA2437C90Edisneycom_ Content-Type: text/html; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable

On Aug 27, 2022, at 6:30 PM, Ihor Radchenko <yantar92@gmail.com> wrote:
* lisp/ob-python.el (org-babel-python-initiate-session-by-key): Do not
rely on 10ms delay to initialize Python.  Wait until python process is
initialized using `org-babel-comint-wait-for-output'.
---
lisp/ob-python.el | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index 932aca08e..e50a7c2e2 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -197,8 +197,7 @@ (defun org-babel-python-initiate-session-by-key (&opt= ional session)
  (setq py-buffer (org-babel-python-with-earmuffs session)))
(let ((python-shell-buffer-name
       (or= g-babel-python-without-earmuffs py-buffer)))
-   (run-py= thon cmd)
-   (sleep-= for 0 10)))
+   (run-py= thon cmd)))
       ((and (eq 'python-mode org-babel-python-mode)
     (fbo= undp 'py-shell)) ; python-mode.el
(require 'python-mode)
@@ -217,6 +216,8 @@ (defun org-babel-python-initiate-session-by-key (&opt= ional session)
  (py-shell nil nil t org-babel-python-command py-buffer nil nil t nil)))
       (t
(error "No function available for running an inferior Python")))=
+      ;; Wait until Python initializes.
+      (org-babel-comint-wait-for-output py-buffer)=
      (setq org-babel-python-buffers
    (cons (cons session py-buffer)
  (assq-delete-all session org-babel-python-buffers)))
-- 
2.35.1

That works for me. I'm using a series of python blocks to c= reate org tables to be inserted in specific places in the document. So each= block is named for that reason.

Do we need to worry about the note about not appropriate fo= r large blocks of code or does that not apply in this case with the way you= implemented it. 
(org-babel-comint-wait-for-output BUFFER)=

Wait until output arrives from BUFFER.
Note: this is only safe when waiting for the = result of a single
statement (not large blocks of code).

Mark
--_000_0324EA8CCB50473EA10668DA2437C90Edisneycom_--