From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 2OuHHdsCpGTgUAAASxT56A (envelope-from ) for ; Tue, 04 Jul 2023 13:30:35 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id yAsUHdsCpGR1MgAAauVa8A (envelope-from ) for ; Tue, 04 Jul 2023 13:30:35 +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 2629823E3E for ; Tue, 4 Jul 2023 13:30:30 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Y6ABCj5q; dmarc=pass (policy=none) header.from=posteo.net; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1688470230; a=rsa-sha256; cv=none; b=bM45+Bm5HpS6/wcW6rK5A+aoGU+R8g5pANBRIKubzhYowdBUQqF+1ipkBZpakA2kKv9qMN dMZLcADkCTpl0GgDM29XjbyoMnit4E+mC5GmvbTF5shDpXqB10hu3HPO+cqlaW0dzVJPCq 9wIVjz018ylPrsyr5AhG/SaOTOI7tHun1akraXqNZLbhKCaM52Cm6t89Px4pUqyYkHP32G qmy9+I2mxrTNx+thAcvxJb4kIdl54ajqopP6hqx/CwT0m5ZQ3wnuZZkU7tckHxVeVLLEy3 JFU8meibGrEzdi7E8OdgNLNm7XbNX5pg9hTdFpVTJo9yNoALKyRFoF3MELw/qQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=Y6ABCj5q; dmarc=pass (policy=none) header.from=posteo.net; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1688470230; 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=cS4qe3DBLfZGVnZa+gqxYq3oWnFOCjcatwoW3JbETD4=; b=PVoI1dD6U6YNJcg3N5KlVXPVymB0Ave0oVC0loSdBQf6jbuPYz1MKDeGqSXTsC0Un4bDnZ nmXTRAyFKtOqeEOpAnADynHX7X3rW8NaULDLla76r83N1oSWBZCVvoTj8scNqMDRfwbqCg imYAVcefnxlviiGqbPjNqsx4Gy5KJYHmJFu5RGijE5+ZpMfIsKKc/Z04vfr6I25NBAO6Pk LpXlxo5OAshEfr8jNEgz2HTwG8ISrBRxGw4X13FM/bJnlJV6PlCQCWysfc/+ZvXaTkztx8 pFVkOSNz31owNPfQxW3UwDF55nk8zWfY56GJyuJQgehZ/8N1RG+jArXOKWnMdQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qGeDr-0006Co-IJ; Tue, 04 Jul 2023 07:29:31 -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 1qGeDm-0006CL-OO for emacs-orgmode@gnu.org; Tue, 04 Jul 2023 07:29:26 -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 1qGeDk-0002og-NB for emacs-orgmode@gnu.org; Tue, 04 Jul 2023 07:29:26 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 9ADE7240029 for ; Tue, 4 Jul 2023 13:29:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1688470161; bh=ZHx2W7ebaMBjaGlfBeC581QmKP24bZknoj2P14KubLA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=Y6ABCj5qEPBnl7xSJ/FnHBKmXbkoLGinnQbc76yARnPAVbxiH3VIplg7vBuw9yrAa gTMYqWfmb6l6w78Gqtqo2RTTDbUXqxkT9bbWrm5R8kxFgibtdRvWAXNJAT8iRSweph 8FpCi5KY6O814stg9NHUY06s6QYxojsXwgpAiN7ae0TlY9voNPl10a+4Vk3lebOSX7 52KXpJL71KPuvwbi3/4oGhSFYB1if8Q9bdNAetYN/GdDE9dHPvNEu5s+zw5UlMKEJf 2zdTsPRhRLp/VkXHePWfl0iIT7sGFqf7/L+9005uwSKMG2KRcXjpVDjjkLuWuJ92jr GRS/2RLCe6z2w== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QwLD10wDfz9rxK; Tue, 4 Jul 2023 13:29:21 +0200 (CEST) From: Ihor Radchenko To: Liu Hui , Jack Kamm Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] ob-python: support header argument `:results file graphics' In-Reply-To: References: <877crh8htb.fsf@localhost> <875y71fcic.fsf@localhost> Date: Tue, 04 Jul 2023 11:29:20 +0000 Message-ID: <877crfvrsf.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, 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -6.24 X-Migadu-Queue-Id: 2629823E3E X-Spam-Score: -6.24 X-TUID: XJRZnoOUa3XF [ CCing ob-python maintainer. ] Liu Hui writes: >> May you elaborate? >> >> #+begin_src python :results file >> implies that the result of execution is file _contents_. > > It is consistent with current behavior, e.g. `:results file' is used > to produce graphics file > https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-python.html WORG documentation is not accurate here. More precisely, #+name: some-name #+begin_src python :results file :file-ext txt will interpret results as file contents of "some-name.txt". If the block has :file parameter _or_ :file-exp parameter and #+name, the results of evaluation are inserted into a file. Otherwise, results of evaluation are interpreted as file name--*undocumented*. That said, your patch should still work fine even with these considerations. But we may need to sort out this undocumented behaviour. Probably, an error like in `org-babel-graphical-output-file' should be thrown by `org-babel-generate-file-param'. > Any src blocks worked in the past still work with this patch, without > any adjustments. The patch only makes the following src block, which > cannot produce `test.png' in the past, can produce `test.png'. > > #+begin_src python :file "test.png" :results graphics file > import matplotlib.pyplot as plt > plt.plot([1,2,3,4,5]) > #+end_src Right. What about #+begin_src python :file "test.png" :results graphics file import matplotlib.pyplot as plt plt.plot([1,2,3,4,5]) plt.savefig('test.png') plt.plot([5,4,3,2,1]) plt.show() #+end_src -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at