From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id oI/RJhQzwGX0rwAAe85BDQ:P1 (envelope-from ) for ; Mon, 05 Feb 2024 02:00:04 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id oI/RJhQzwGX0rwAAe85BDQ (envelope-from ) for ; Mon, 05 Feb 2024 02:00:04 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="S9k/9ewk"; 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=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1707094804; 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=yuwv4f8xAvgLkJ9fIgyhj2K0jFRT8GYO3QrY6JS1Jpw=; b=P63N6Fu2HO/EWx3nx6SRs0I1V3dOVAvRYfjVBeNaGlNeNC78Q6rLvgX1VxlHycepWqESNT IQGnQtxNxwVyZRMtubQO+oGuIM/fOeVieRNwPAlUYsoKqtSGdSrbRVa0P+1vhF7FdIIJwz Jn/ZC/H7NetuHJiaohYH1I8cDkld2/hrJ7CeWZxdnbESQ0F26Gzt2wWrLlUpCjyWkj33OZ jZQzRcvVKhAhoQi5opGQmmVTgQaksw9U9ymXex53VMsrPAedZ4oVzZTnE585bjXCthv/iP zs2PnnyZTnFq2AsqoQgHLToq3tTHhyBZSF3Ug8OepWr8ulD7FM0sxLCN/62lLw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="S9k/9ewk"; 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=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1707094804; a=rsa-sha256; cv=none; b=etY1zUahpxAVzuENLI2HTY+a/ww5WyAtInKxzo4T2GyJxIKZBXAhxiDxOeJmHXn3exrXyC 4k0GAFQCCV4FOAKK/8Z6jExfQhfvemfgb/unrPKsIdLE1VruRS4hx7U+gr1cBimvfAHjuG 2/FIs90xBmhCURRMlNSornkHilFminFugCAlkOe5qI15FTjzKVxJzXc/giwTHLHNZ5RXeZ +S4KgF5/SUcBb8ivivBvnT9VG953oQwVweOSUj5hdN2dw5x4z7YZN8S0i+JpHuVB7zlslU oZZDH9btakYrCFqtKg2SKsXC2zrJF+4YrZzpr5aibIkA1LlYSw3KOzk/98cIGA== 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 43C96512AF for ; Mon, 5 Feb 2024 02:00:04 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rWnKJ-0005tR-QF; Sun, 04 Feb 2024 19:59:11 -0500 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 1rWnKI-0005tD-1U for emacs-orgmode@gnu.org; Sun, 04 Feb 2024 19:59:10 -0500 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rWnKG-0002a8-E3 for emacs-orgmode@gnu.org; Sun, 04 Feb 2024 19:59:09 -0500 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1d98fc5ebceso2633115ad.1 for ; Sun, 04 Feb 2024 16:59:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707094747; x=1707699547; darn=gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=yuwv4f8xAvgLkJ9fIgyhj2K0jFRT8GYO3QrY6JS1Jpw=; b=S9k/9ewkxiIdMYYOxmhpP5w+G2mV/F/v49Q1En+pXoyqqOzDy8CcueUJb+nQv1El+3 RXwiYANVnwRb9qDj5T7YPM2pSHAqXGfz9trhZPxo/Ad6aDtnoOY8Cxljt2Q4fmpaeW7W q2gnkkqkMDorB2liJ0iNGfGB4ZvdGxr/NmUlDMR1sdB9eHV8y8H/yDH1DxK5KxiBKPSv zId9XJjkFoatNGjBjhp8Nb+yrPs2Lu3muTqv8rcDrHm/58PS/B/cxhB95r5U1UkVK720 7WMk/8cX1ZD4mUh4nDBWa1kOJUKyCO7SB39mpJbep2k4SbbbpsPN7niEm1Vx9Bwb22jk /0pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707094747; x=1707699547; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yuwv4f8xAvgLkJ9fIgyhj2K0jFRT8GYO3QrY6JS1Jpw=; b=XNgAyALm3wsXyxqgTsZIQmbSXWPXLOLvRk8rZCULb0NY7HsmSL3GmLTWT8+sg0dHkm DINijORMAlNc9ORIPXR1dJ5FSylm2pPsVFyLWBbhlGJDBlDPV1QpaJyytiFNYPjhikE5 io0SP2XC7IAMTuYolqXBdm+brNr7eR2womK2fVUWRbmc3sHLD7D4NESaaUMoQNO3O8TR Hk5R3zYrrltKu9+mY7uSOZ9LPgnlzQdyCCK+c7BP7jn6tBDXIetPxqeLVj00oMKuNrpe 44w4xLYl0aUHgccM98+CfY6hq/z9MjTPngAi5DUedsZMyty7ptE78AHkrIcNaH2oexU0 YPNA== X-Gm-Message-State: AOJu0YyFK7eKKs1SqUwPz4qyn/+9AQG8zjC3fLxD4K69LgjvXZfL82LI Sgus5r8U26EsgjfRz+SK67UMF2UsustyJ8lvFr7oZCekfdxdIdai X-Google-Smtp-Source: AGHT+IFwEWOs3HKOa7uLLvYSA+5YUduAKUDhCKRFMF+b2dA2VSMV/n84ztp4zKdizx/9acB0GwxtqQ== X-Received: by 2002:a17:902:d2c4:b0:1d9:b8cf:795 with SMTP id n4-20020a170902d2c400b001d9b8cf0795mr1381609plc.58.1707094746543; Sun, 04 Feb 2024 16:59:06 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXfR24gWXKxSfS5FqT1i8RIPdYtvze54VTudb6t7QG5eTWyuiE0cjNpCWENY6icWLiCmG63GC+F6KcDoTrwOY8SQFYpmZE= Received: from localhost (157-131-78-143.fiber.dynamic.sonic.net. [157.131.78.143]) by smtp.gmail.com with ESMTPSA id ld12-20020a170902facc00b001d95d1078fdsm1121408plb.56.2024.02.04.16.59.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 16:59:05 -0800 (PST) From: Jack Kamm To: Ihor Radchenko Cc: Nasser Alkmim , emacs-orgmode@gnu.org Subject: Re: Async Python src block behavior with :dir header property In-Reply-To: <87y1c019a7.fsf@localhost> References: <87il3a55bg.fsf@gmail.com> <8734udvjai.fsf@localhost> <86plxhely9.fsf@gmail.com> <8734udoejo.fsf@localhost> <86y1c5cztv.fsf@gmail.com> <875xz9o4nj.fsf@localhost> <87plxg95u4.fsf@gmail.com> <87msskmm47.fsf@localhost> <87mssi8ht2.fsf@gmail.com> <87plxdmtq3.fsf@localhost> <87bk8x81g3.fsf@gmail.com> <87y1c019a7.fsf@localhost> Date: Sun, 04 Feb 2024 16:59:05 -0800 Message-ID: <877cjj915y.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=jackkamm@gmail.com; helo=mail-pl1-x62e.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, T_SCC_BODY_TEXT_LINE=-0.01 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-Spam-Score: -9.27 X-Migadu-Scanner: mx13.migadu.com X-Spam-Score: -9.27 X-Migadu-Queue-Id: 43C96512AF X-TUID: rExKFuQdBc+m Ihor Radchenko writes: > Thanks! > Attaching the two patches combined with some fixed to my patch. > > Please check if these two patches solve the discussed bug. The original bug for async sessions looks fixed. But I encountered a complication regarding the non-async bug of changing :dir. In particular the following example: #+begin_src python :dir otherdir :session pysession :return figname :results file value :mkdirp yes import matplotlib.pyplot as plt plt.figure(figsize=(1, 1)) plt.plot([1, 2]) figname = 'fig.svg' plt.savefig(figname) #+end_src #+RESULTS: [[file:otherdir/fig.svg]] #+begin_src python :dir otherdir2 :session pysession :return figname :results file value :mkdirp yes import matplotlib.pyplot as plt plt.figure(figsize=(1, 1)) plt.plot([1, 2]) figname = 'fig5.svg' plt.savefig(figname) #+end_src #+RESULTS: [[file:otherdir2/fig5.svg]] As you can see the second result points to the wrong directory. However, if replacing ":session pysession" with ":session *pysession*", then it works. It's because ob-python starts the session in buffer "*pysession*" (it adds earmuffs around the session name when missing). So the following doesn't find the inferior Python: > + ((when-let ((session (cdr (assq :session params)))) > + (when (org-babel-comint-buffer-livep session) Honestly, I'm not sure why ob-python insists on the session buffer having the earmuffs, that behavior is from before my time. In particular, I'm not yet sure if the motivation is just cosmetic (because of the general convention like *shell*, *Python*, *R*, etc), or whether it actually affects python.el behavior. But if it's just cosmetic, then we might consider removing this behavior to simplify things. Though note that ob-python is not the only one with this sort of behavior -- looks like ob-lua might behave similarly, and until recently ob-R also had some surprising behavior depending on whether the session name had earmuffs.