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 vn9bM3X832SLXQEASxT56A (envelope-from ) for ; Sat, 19 Aug 2023 01:19:17 +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 sEddMnX832SlBwAAauVa8A (envelope-from ) for ; Sat, 19 Aug 2023 01:19:17 +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 E3A4960164 for ; Sat, 19 Aug 2023 01:19:16 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=rH6V5R+5; 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=1692400757; a=rsa-sha256; cv=none; b=SOnZitTUmDMrb1okfeAZgphcYzxMnWWBxCdjLdKryYC+jwOYt1+a2rZt2eErHRZS0eMfHi puYAFtMr3Qhp6MWb5CL36wz3DbNlc/i/46+jEVHeYg5U1Q3bs8HZFnomRFke4yAjzDyoES OMwwORyhgbLiSEIN0xERYE4n7J1dCUPuSqXIH6uXurhp+JxMOOIypCb8TKorvc29PmHhw0 KQRk6yxnph1nQe4lR8J6t4norQ3YYAiSInbRgy8NKrxsPMNIGCQEJehA+d5SkLz2MwzEFc jXBdo91A79H6mOM0OIrIDorhpXBVmZoaqHGyEvY0Wg0M4ARISFnAF/EVbSiLHg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=rH6V5R+5; 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=1692400757; 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=Pj0O/RGXNOhCua2B8zONrHUKBQMoZ9heNT3iQcwWvTs=; b=SBSp3TstsgSwe7gowNAgu0OhlYE7cDDv9/lKjST6kpyn/e/6C3+Pfcl9dyqclmzMgz/kx1 CEF0OwlPd5LWYGm39jNzMIyFVGwjTyOYLEQf3bRvJD05Tw3zMipcRb82MwT7Mo3HdutVQs HPNADDX1Ya5NJWCky6hWLVMefTpgyGCnPMwA8fgMDPik4Dm5BseYROuYXx0BJ/jJvhDhRV /UXUZDTXqA1Zkc0ePbx48NGDqhfl2goEkDbDgVF5to8tiRttnL5NdxHiedQ7MQgKt5YiE4 JBt3IjILegLQyyGXuQVSlqbhMCCqTeYU4KsXUkbvLlgJfu58RarilNK75yTnzQ== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qX8jg-0004s6-6j; Fri, 18 Aug 2023 19:18:32 -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 1qX8jc-0004ro-RC for emacs-orgmode@gnu.org; Fri, 18 Aug 2023 19:18:29 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qX8ja-0005bD-AQ for emacs-orgmode@gnu.org; Fri, 18 Aug 2023 19:18:28 -0400 Received: by mail-pf1-x433.google.com with SMTP id d2e1a72fcca58-689f4fb1c29so1029010b3a.0 for ; Fri, 18 Aug 2023 16:18:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692400704; x=1693005504; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Pj0O/RGXNOhCua2B8zONrHUKBQMoZ9heNT3iQcwWvTs=; b=rH6V5R+5qoRL+SFVSSaWGC1iLJP59Lvq3f2BqOkWE+M6Yyh17W61Ucd+7lbj/2DMoN jfnFVkpQVr9CdadpmE0M+OubpFU7XWSGoJxe9od3cEmItdsVq4rXh2jahSH3rI+y9icg 8xLpcGfIb+tN5Tj/Uza3hJaJd571GrcpNNPkBsO5+qa+wm7yEM6iZ6gGt0BLL53pHr8I ytRPZAdYiBnZMtzgHYq7AtOuZv+7jokhznzT4Kdty5O2WIViwGdUoH2yWdi99xVX3C1V efBm1H76hSHVE6MR1Jvu57joskGfFf7OcJPM67M2WKMp+JGf7kvEDvjeO8OpQQEZaAUj 8FiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692400704; x=1693005504; 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=Pj0O/RGXNOhCua2B8zONrHUKBQMoZ9heNT3iQcwWvTs=; b=ZItbCwTknbdWRbBLPtC1aK8ezPTuZRURTaNMcxbb3o8EerWWAPnhzc5uUVMDMWYyay gvDDO5hxwrn/W/rcxmq9ZNX15Pw8GTLlfi1JQ+8sof2DNUASC67wWAhyVakYVo1ID0qF qCPJDy9mKibs2FnswmjgDx4oGjcswCXwYMcM9ZBwz5wVdephoo0oeG6ty1ytXHRHTiXv oWjlNGnBuf+eDEPCwut9t3g00OoPQOUCuLYFHtx0Rtyg/xhq3V980Hk41p4TJRPwr+8l B4vs0mOe4AuQ/R/jTI40IGf0rHlvbX00c1PxdnDdYckYeMiE9fRpsOengf4jh7Lm9aV3 qR+Q== X-Gm-Message-State: AOJu0YwSmbRcvKWgvSLAi7C4A31UQpy6lLbo9tbm+VkND39wZDOjPAoc s2oG/8HmEaWwIjQjZaxvnJ5iPSzGdAc= X-Google-Smtp-Source: AGHT+IFN5299b61dEs8U0SSIWwCHiFtsV3vM22yuiloq49F+q5BZWE3jd4vUYpMzqbG5455Eez0XUg== X-Received: by 2002:a05:6a00:2281:b0:682:5e8f:d8ba with SMTP id f1-20020a056a00228100b006825e8fd8bamr938676pfe.11.1692400704516; Fri, 18 Aug 2023 16:18:24 -0700 (PDT) Received: from localhost (157-131-78-143.fiber.dynamic.sonic.net. [157.131.78.143]) by smtp.gmail.com with ESMTPSA id fm17-20020a056a002f9100b0068874e1faf2sm2035180pfb.56.2023.08.18.16.18.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Aug 2023 16:18:23 -0700 (PDT) From: Jack Kamm To: Ihor Radchenko Cc: emacs-orgmode@gnu.org, Liu Hui Subject: Re: [PATCH] ob-python results handling for dicts, dataframes, arrays, and plots In-Reply-To: <87cyzlriem.fsf@localhost> References: <87a5ur6f7w.fsf@gmail.com> <87cyzlriem.fsf@localhost> Date: Fri, 18 Aug 2023 16:18:23 -0700 Message-ID: <87bkf4aqio.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=jackkamm@gmail.com; helo=mail-pf1-x433.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 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: -9.52 X-Migadu-Queue-Id: E3A4960164 X-Migadu-Spam-Score: -9.52 X-TUID: Zvghcm8THg9Y Ihor Radchenko writes: > This is an ORG-NEWS entry for Version 9.4. Is it an intentional change? Sorry, that was an accident. I've reverted it now: https://github.com/jackkamm/org-mode/commit/f12a695d67bc5c06013d9fbe0af844c9739e347a >> @@ -142,7 +144,9 @@ (defun org-babel-python-table-or-string (results) >> "Convert RESULTS into an appropriate elisp value. >> If the results look like a list or tuple, then convert them into an >> Emacs-lisp table, otherwise return the results as a string." >> - (let ((res (org-babel-script-escape results))) >> + (let ((res (if (string-equal "{" (substring results 0 1)) >> + results ;don't covert dicts to elisp >> + (org-babel-script-escape results)))) > > You may also need to update the docstring for > `org-babel-python-table-or-string' after this change. That change got reverted in subsequent update when I changed dict to return as table by default instead of string. So there's no need to update the docstring anymore. >> - body))) >> - (`value (let ((tmp-file (org-babel-temp-file "python-"))) >> + (if graphics-file >> + (format org-babel-python--output-graphics-wrapper >> + body graphics-file) >> + body)))) >> + (`value (let ((results-file (or graphics-file >> + (org-babel-temp-file "python-")))) > > What about :results graphics file ? Not entirely sure what you mean here. When ":results graphics file", then graphics-file will be non-nil -- org-babel-execute:python passes graphics-file onto org-babel-python-evaluate and then org-babel-python-evaluate-external-process. In case of ":results graphics file output", org-babel-python--output-graphics-wrapper is used to save pyplot.gcf(). Or if ":results graphics file value", then org-babel-python--def-format-value saves the result with Figure.savefig().