From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id sAIGOL8jumX99AAA62LTzQ:P1 (envelope-from ) for ; Wed, 31 Jan 2024 11:41:04 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id sAIGOL8jumX99AAA62LTzQ (envelope-from ) for ; Wed, 31 Jan 2024 11:41:04 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=XXdbaASW; 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=1706697663; 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=orw0bFcHuzanAjH3ygSInDkBj7SCRkb+cJ7MPF4RsRM=; b=LDnYykDv8hSf4+XnFbdzRD4JJWrx0CAqr0kQUXiQ2etgpTQU8txYjMxbsr3siYx5tqtkOv q3ysoU0HTT2jIGbh/XSjG6mZFq48wbtfjXEOpUe+8b/2hCg5jTg1HgR8GEjeuU2EzvPVY/ kiFZXVuhb+tifxpBSoGEpKX21rH+U2l6iYGsZh/QzIR/Rg+ge3OYWsNIQVI9mqhKGnaPKx IrQ709Jo7BXvrTJQTaoPSgc757V42DU0GfCP3XqSj9mWHfxwyQvY/YUZDkk+i4xhElH5Xw hEArYPahVPC2wk6g0BYs3f/WxSoLe29g7KSNyMVHXIf2rtR1dWYZdba44byMtw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=XXdbaASW; 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=1706697663; a=rsa-sha256; cv=none; b=BJ9ulETRCtQmCSzmqqjMoVMlP7AyrXCosxkSvTHVfQzPw9aqRVB/Vf1zrY+H/gIKljAOro 2Ef2R7iV+VmNVDiwkP8AzZJEy4j4NDaV7RnBkFmjRpaz/+5UcGZlc92JBFr3uPYD6CrWcQ NbSLzwRP68ib0mGG5+Aex9LiII642zKC30IpzMJ5ZXaLXu6LhckcU7eK5XvtOQ1mkg4G9N BkJ/GsBdXs1tiaeZxr26SScen6fNsS7+GY2DdKo30uDoUlWebWGE6nr++4oEjO6GmXOLOp IRpV49gjF8BVHhnAzITQRoBEcj4bZZ9yRTeRzKLN7MaVco7q8LutJ5nnQT3a6w== 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 B21423CF59 for ; Wed, 31 Jan 2024 11:41:03 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rV80l-0007Yu-Vd; Wed, 31 Jan 2024 05:40:08 -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 1rV52O-0001go-4K for emacs-orgmode@gnu.org; Wed, 31 Jan 2024 02:29:36 -0500 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rV52F-0007en-Py for emacs-orgmode@gnu.org; Wed, 31 Jan 2024 02:29:29 -0500 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-51117bfd452so3223093e87.3 for ; Tue, 30 Jan 2024 23:29:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706686165; x=1707290965; darn=gnu.org; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=orw0bFcHuzanAjH3ygSInDkBj7SCRkb+cJ7MPF4RsRM=; b=XXdbaASWoC6zWVJQAAdlnob7+Kgi7eqvAs8f69Q3OnBeD5lF9PkUzqZo/X3uyFTId5 Ycw6kyPDnFvyeipCGbAFlCZBRpiAD/MwbzclLE+xxw3zPSsPi6ptWhl+ZnW8PwTVEnzF 1XKXr91BnBtihcCX8pPz53OJ3XiAhydNTy8bibXNen4wzsOzrfK8NezXMxZ2gIjqIdZH UEQlWanIJuitjEpfL9dZVKL0ous3bp5tKfNLPmbOq4MTLMcnz+A9r/F2pNHo7gchpR/v dSTe5yTuxFKiAR8oLAhnBJuXGRQNQsNft+aQGyviyjj/CUmOrEXU+U8HGF15nRZGhBtZ TqKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706686165; x=1707290965; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=orw0bFcHuzanAjH3ygSInDkBj7SCRkb+cJ7MPF4RsRM=; b=L7pQeHy661YKXnNF8ySjgFKeoO6C+WQc/THMRSkSv1n7c9i4rCabWdvG4zW7IA0FTC D7isMCmZMZVVNZmD3Xp3RMp5hLqY71t3r9hfLVUyIA2LUJwss8wr+opfPOQbbTlvV+sX nrxNOVt+6PQFjNPVtpdcmM/qP15B1SwUogjwADOS0s1YqYt906rtJws8u+U92MBgR5Jm 4xMSEtwtMO9oFo0ZnZcG1Wo2hYt5qoyjJuUoQfUED/Y/NdXrt6KIIhKW6kMPlPkxU6MP scwFd4hIF93Do5CWsgUb2hEKMewkYBwW9rN+4TP4zJJejGYcgjwbrIs14nuljNloMDUb PoxA== X-Gm-Message-State: AOJu0YyEOIEy9MIcm62uSvLEvexbdQSxNodezo/FanfCUYdGMBJwAYgg 1kjWuN8SFStFQowyDiIutFg8HcJgX3NlHptt7Rok9oJOUqiVao0IYYmXFsFD X-Google-Smtp-Source: AGHT+IHPw3rJzXXUijJ32B8a8fWKVJvCp4hZraPO+6zR9OwcFvchlqD0MtdNBOfQyp80wAJPrSi8Eg== X-Received: by 2002:a05:6512:3a1:b0:511:171e:201 with SMTP id v1-20020a05651203a100b00511171e0201mr607154lfp.69.1706686165052; Tue, 30 Jan 2024 23:29:25 -0800 (PST) Received: from nasser-t14s ([212.56.161.0]) by smtp.gmail.com with ESMTPSA id v16-20020a05600c471000b0040fb6295018sm63541wmo.12.2024.01.30.23.29.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 23:29:24 -0800 (PST) From: Nasser Alkmim To: Subject: Async Python src block behavior with :dir header property Date: Wed, 31 Jan 2024 08:29:23 +0100 Message-ID: <87il3a55bg.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=nasser.alkmim@gmail.com; helo=mail-lf1-x12a.google.com X-Spam_score_int: 26 X-Spam_score: 2.6 X-Spam_bar: ++ X-Spam_report: (2.6 / 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_BL_SPAMCOP_NET=1.347, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 31 Jan 2024 05:40:03 -0500 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.96 X-Migadu-Queue-Id: B21423CF59 X-Spam-Score: -9.96 X-Migadu-Scanner: mx11.migadu.com X-TUID: Q0lrlCe3GGtV Hi, I'm in the latest Emacs GUI. This works, the =return figname= apparently can recognizee that we are in the =:dir=. #+begin_src python :dir asyncpy :return figname :results file value import matplotlib.pyplot as plt plt.figure(figsize=(4*.5, 3*.5)) plt.plot([1, 2]) figname = 'fig.svg' plt.savefig(figname, transparent=True, bbox_inches='tight') #+end_src This does not work. Even though the python execution is in the right directory and the file is saved correctly. The =return= does not produces the right file path considering the directory. #+begin_src python :dir asyncpy :async :session :return figname :results file value import matplotlib.pyplot as plt plt.figure(figsize=(4*.5, 3*.5)) plt.plot([1, 2]) figname = 'fig.svg' plt.savefig(figname, transparent=True, bbox_inches='tight') #+end_src If we inform the right path to the return statement, it works. #+begin_src python :dir asyncpy :async :session :epilogue figdir='asyncpy/'+figname :return figdir :results file value import matplotlib.pyplot as plt plt.figure(figsize=(4*.5, 3*.5)) plt.plot([1, 2]) figname = 'fig.svg' plt.savefig(figname, transparent=True, bbox_inches='tight') #+end_src Another alternative, we can use the =os= package to get the current directory. #+header: :epilogue import os;figdir=os.getcwd()+'/'+figname #+begin_src python :dir asyncpy :async :session :return figdir :results file value import matplotlib.pyplot as plt plt.figure(figsize=(4*.5, 3*.5)) plt.plot([1, 2]) figname = 'fig.svg' plt.savefig(figname, transparent=True, bbox_inches='tight') #+end_src Is this behavior as expected? Is there a better way to have the figures from the python block with async execution? -- Nasser Alkmim +43 677 6408 9171