From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 2DYrIOFr6GSbxAAASxT56A (envelope-from ) for ; Fri, 25 Aug 2023 10:52:49 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id wNYRIOFr6GRdywAAauVa8A (envelope-from ) for ; Fri, 25 Aug 2023 10:52:49 +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 E2E7D6DC72 for ; Fri, 25 Aug 2023 10:52:48 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=d62z7j1Q; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1692953569; a=rsa-sha256; cv=none; b=QJ9VnRowDK7Y8lV8lUe6SOmoJX4hZPxUXMV5WPbFmu8/y3Ki0J+wVTWPt2+4AcvCNw69Tm QGwK/Vxt3vJZJ9a7dqPZ5U8OIAJL4MhyE9S6l4Ka1/+0VPSTzv4zPsEsvaFpK5PuOfPRC+ KBgS44WL9g2o/EXSuRqsjDAdS8j0GFki3MYI/7RJaeR6ynnxnyH0zw0ofVwK8yMHLWzqLm CVMnhu+p0S74bFZj8rTbcpViLirXklSTQz6JvjIExuv8KMj0PwLPIEAXf+Bbdt2PDQiiNE Dqst5fPS3HUAnb2vxyk4S9ZSnTMqLVQLu/CThF2Y0V3gzUf48debuxo8UHFcDw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=d62z7j1Q; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1692953569; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Bsm2z1AZJ0UIX8sHEzYhT2yHim+nEVJiS0A/SL+t7xc=; b=FT7mHlp5DS2XO2wc6ePxKVP6QC9kZ37MA36aZPOBnaEGVMIh9u75DvxzGYBaRrNpeS+yzM mm0eobhZh4YS6UnpLji8hFWCAsYaDAHbh/0i35otKOFMMvYcUdnFqZVTGNJ0k6/nwETwUq YhrjNe7O3j42eSHbu51cXycNyGp3WLf6nfSS1D9tncEELIgNYX05SXWUmw1GhQa0WU9x/2 Xs0raacYsArjfuPP0AMmP+QrBT/vi+W60KMIrg7ZxggzQvKdq9uD0k86td4KrJhIysMFww WGWJlPMlrN1G8NaKLAPoOJsJT/uaoWKJHdWZfwB4mFgLq6TII6b0CipCrzTwXA== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZSXs-0006fY-Sd; Fri, 25 Aug 2023 04:51:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qZSXr-0006f5-9X for emacs-orgmode@gnu.org; Fri, 25 Aug 2023 04:51:55 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qZSXo-0003mk-F0 for emacs-orgmode@gnu.org; Fri, 25 Aug 2023 04:51:55 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 3D9C0240029 for ; Fri, 25 Aug 2023 10:51:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1692953509; bh=0O7U8t9LX73RVi423mge0rf88I+W6VdpnW9HOqeMlKw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=d62z7j1QKRa8Eix0GmgaYsT7YOD9ewQBS0kWfVvIzupiic4bZPIFbE7307IGYHKSI ut+j0OCQfbgkQ4+X3RxD9vhrxl/vnuT1FB024zX0gRAMRh6i8WQJ+Fjpif759VKeUE Hvb3mqRFa5VGVMS/dAF2CrYRXT6t5uIulLghQmoTmpMZzXv7/oLz4J5y2HkIbwpieu H1Qf0Yv9Qo8BWHesD1ZEbkX+7QRppLyZOT4emn7k54pkFvf/8eKmbjELZKpj3v8OmE 84sqW3x0GpBHRMfSAxRRnMujcIGlkQdazD/9PTSqVLPVY6K8EqKQSjC0HMKFpWA0R0 NF3upuIydYgZg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RXDGD43nYz6tx8; Fri, 25 Aug 2023 10:51:48 +0200 (CEST) From: Ihor Radchenko To: Peter Mao , Jack Kamm Cc: org-mode-email Subject: Re: [BUG] ob-python hangs on second start [9.5.4 (release_9.5.4-763-g06373a @ ~/emacs/org-mode/lisp/)] In-Reply-To: References: Date: Fri, 25 Aug 2023 08:52:18 +0000 Message-ID: <87ttsnh5bx.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.29 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx0.migadu.com X-Spam-Score: -7.85 X-Migadu-Queue-Id: E2E7D6DC72 X-Migadu-Spam-Score: -7.85 X-TUID: ZiV+9PfXa4Nv Peter Mao writes: > Expectation: When running ob-python code blocks, I should be able to > kill the python session in the *Python* buffer and run another code > block (or the same one). > > Problem: ob-python works fine on the first execution, but after > `exit()`ing the python session, it hangs without executing the code. > After a `C-g`, the prompt in the *Python* session shows up, but one then > has to re-execute the code block, as none of it has run. Confirmed. It looks like `python-shell-first-prompt-hook' does not get triggered in the described scenario with exit() and we enter infinite loop in the code below. (add-hook 'python-shell-first-prompt-hook #'org-babel-python--setup-session nil 'local))) ;; Wait until Python initializes ;; This is more reliable compared to ;; `org-babel-comint-wait-for-output' as python may emit ;; multiple prompts during initialization. (with-current-buffer py-buffer (while (not org-babel-python--initialized) (org-babel-comint-wait-for-output py-buffer))) -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at