From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oH2xF+XAOGG03gAAgWs5BA (envelope-from ) for ; Wed, 08 Sep 2021 15:55:49 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 2AotE+XAOGF5PAAA1q6Kng (envelope-from ) for ; Wed, 08 Sep 2021 13:55:49 +0000 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 7E4982660E for ; Wed, 8 Sep 2021 15:55:48 +0200 (CEST) Received: from localhost ([::1]:42704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNy3H-00033M-75 for larch@yhetil.org; Wed, 08 Sep 2021 09:55:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNy2S-00033C-It for emacs-orgmode@gnu.org; Wed, 08 Sep 2021 09:54:56 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:33789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mNy2Q-0002JZ-2h for emacs-orgmode@gnu.org; Wed, 08 Sep 2021 09:54:56 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 192-20020a1c04c9000000b002f7a4ab0a49so1301868wme.0 for ; Wed, 08 Sep 2021 06:54:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=andrew-cmu-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kLCpao75LLSDfqzf8hwgQxBMwT3FSqsuH5jFTTS4ybk=; b=JfTzDBg6BkLcRhjF6DgBWA/bVjXB03igUD5NMvor0umljfSJ4nGoJ3BOCqW0ayba1O KyFhUs58SmdQekpLXX0ZrOlAaUFAFbERMTcazunyEvln83oABxxEmqgdOr5mdyAwVoMR EFvmlzxGF1cffrcfJacK0pNOdqHklhGBIWBNPCgQ8TjYPjxmnqu0ay9FNchENnH8+4pT nPfh5j7M2iV3HRPnJJmDH7yCwy+nsf1xxWbDXta3NG2Kn8oZoVnunSENrLtrvvTCwHqs ZtWnpgGSYl5dUVWXKR99jQUaI5J1PbUhJ5H2xjxZPX/EaZrdio1eO7UvE0ldZb7GCTOt Lo6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kLCpao75LLSDfqzf8hwgQxBMwT3FSqsuH5jFTTS4ybk=; b=yNRqfHtN68XZZqjza6vy1j3PSmdLHKmQhmXZYeAlyg0vre/bfQllRDupUiRdhbbUOm VdkKr3plP/qxZPpRronuVjkWEHHPnz+mf8/upgZ5zhNZ9Gl/ZbqZ6jLLuNJXpahHH1Ll fhRe/7nr47GCkNeNwyBAwVJM3XbRZncBmmUaypdslVqf90hVOu0XMadWO1fvJfnTVaFc +uUd1JT3lsw/A4UvZRDH1KM8kk++4WcVxdVfjJ/iOP2q3J1T6naHmejlgWFto2WlggO3 4PW5EukGa+J0/dMwtgmFK83pXyNtgA2LrT0RRa06t7w8sdU6ft8Kp+feS7hAQOHqdrL3 6t3Q== X-Gm-Message-State: AOAM531jVF7c76Wxal60C4gw79YYaQvub6I2rI4P2ibDpjehFl2hVjlT 5n0UHzYS7xT3AKIllvZYFr57fQ/PbSxG+GSuJAI= X-Google-Smtp-Source: ABdhPJx4dymQwS1MFYqKQVk0ggdYPqylCwVk3EqYku1ffcA75OL6WC23APDFj9z1hOtYMzxOxw98cRevomQbmAKFvZ8= X-Received: by 2002:a05:600c:250:: with SMTP id 16mr3754783wmj.61.1631109292435; Wed, 08 Sep 2021 06:54:52 -0700 (PDT) MIME-Version: 1.0 References: <86h7f0t7mp.fsf@gmail.com> In-Reply-To: <86h7f0t7mp.fsf@gmail.com> From: John Kitchin Date: Wed, 8 Sep 2021 09:54:40 -0400 Message-ID: Subject: Re: emacs-jupyter does not send result form babel block To: Rafael Content-Type: multipart/alternative; boundary="000000000000f72b3805cb7c394f" Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=johnrkitchin@gmail.com; helo=mail-wm1-x32a.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: org-mode-email Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1631109348; 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=kLCpao75LLSDfqzf8hwgQxBMwT3FSqsuH5jFTTS4ybk=; b=GY+roXpe0XaUizbkL5Hu050u/0nR7sQdyHeXYw6BsEFuxX+Y0u4YHLQPKnIqy5d8qtaT4R 8mzkvl0o6u085Nq2FN+cvN4Mka7O3M9Cxefcd+p/pHJlQQBKzY4vl2Evv1Gn832fTefXYe 5VJqsp9EhCVqHTKjxfXmwrArtQ2p060+RyPTuCjBzDNVsJkKhve7UBdZbhpH4reeLmNsF5 Mzgz18ag2N939Z8r5CQBVHocurx/ORq7lnqtodNunouvPBiT9yY4NHX0sVJyQkLFbmY2Ai 2VNFtoJvi42X6bxro/4HUgMEGtqQuIFaqbKu3KLIno+7Oh5Wtkyy/dLV7OfVnw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1631109348; a=rsa-sha256; cv=none; b=VV3jWUK63I6yLmGJ3lwZzt8wuRsv5PCiDjs10gZysP+QNFQrnmzbHxRWDJw6w0qPHh4HpI FbfTgzNWgpc5kVvcYiDSmSHAk+1uF0Nlncb22uPUVf3dDxS2vGHT9gqfA2qNT4HHUp5YFc t9qPE2sdP/xilWgk3xLGgOHt19zJVvjkztpxX8/L7SK/ZIkj8JacJXMVnIWqUWY/+UFFgW 1BrgbQU4Uel740xiqq6A2nW6Zlu4wevuAhu2UHZ7ZV3dIxqUZGw7nb4C1J7FbcrbeckTOk avfqw5pxyNCYhYkQqS2T808zX2ViHI97IiyFBGulhIBUiViFXFjTEUgiAE6oCg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=andrew-cmu-edu.20150623.gappssmtp.com header.s=20150623 header.b=JfTzDBg6; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.51 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=andrew-cmu-edu.20150623.gappssmtp.com header.s=20150623 header.b=JfTzDBg6; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=andrew.cmu.edu (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 7E4982660E X-Spam-Score: -2.51 X-Migadu-Scanner: scn1.migadu.com X-TUID: /c/ZxUgG1xlA --000000000000f72b3805cb7c394f Content-Type: text/plain; charset="UTF-8" I think this is a bug in jupyter-org-client.el in this function: (defun jupyter-org--add-result (req result) (cond ((jupyter-org-request-silent-p req) (unless (equal (jupyter-org-request-silent-p req) "none") (message "%s" (org-element-interpret-data result)))) ((jupyter-org-request-async-p req) (jupyter-org--clear-request-id req) (jupyter-org--do-insert-result req result)) (t (push result (jupyter-org-request-results req))))) The problem is that when the jupyter block is executed to define the variable in the python header, it is run with a "silent" results param. The function above is responsible for adding the results to the jupyter-org-request struct, and here when it sees the results are silent, it does not do that, so the results are nil, which is why you see what you see. I don't think that behavior is correct. It isn't quite right to just remove the first block though, at least in this case. The result in this function is already structured as a fixed-width results element intended to be interpreted as a results string, and not the numeric value returned. So the fix is probably upstream from this. I am not sure what the fix is for this. The code path from C-cC-c to executing the code, handling the request to the kernel, getting results and to the output is very hard to follow for me. I would post an issue at https://github.com/nnicandro/emacs-jupyter/issues. John ----------------------------------- Professor John Kitchin (he/him/his) Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Sat, Sep 4, 2021 at 4:22 PM Rafael wrote: > > I am using emacs-jupyter (https://github.com/nnicandro/emacs-jupyter), > and I have just noticed that results from a block are not sent to > another block. I think it has to do with this issue > https://github.com/nnicandro/emacs-jupyter/issues/222. Can somebody > suggest a workaround? (I actually want to use the output from a kernel > different from python, but since the problem happens also with the python > kernel I'm using it as an example). > > #+name: atest > #+begin_src jupyter-python :session test > 1+1 > #+end_src > > #+RESULTS: graphst > : 2 > > #+begin_src python :var adjs=atest > adjs > #+end_src > > #+RESULTS > : nil > > --000000000000f72b3805cb7c394f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I think this is a bug in jupyter-org-client.el in thi= s function:

(defun jupyter-org--add-result (req re= sult)
=C2=A0 (cond
=C2=A0 =C2=A0((jupyter-org-request-silent-p req)=C2=A0 =C2=A0 (unless (equal (jupyter-org-request-silent-p req) "non= e")
=C2=A0 =C2=A0 =C2=A0 (message "%s" (org-element-inter= pret-data result))))
=C2=A0 =C2=A0((jupyter-org-request-async-p req)
= =C2=A0 =C2=A0 (jupyter-org--clear-request-id req)
=C2=A0 =C2=A0 (jupyter= -org--do-insert-result req result))
=C2=A0 =C2=A0(t
=C2=A0 =C2=A0 (pu= sh result (jupyter-org-request-results req)))))

The problem is that when the jupyter block is executed to define the vari= able=C2=A0in the python header, it is run with a "silent" results= param. The function above is responsible for adding the results to the jup= yter-org-request struct, and here when it sees the results are silent, it d= oes not do that, so the results are nil, which is why you see what you see.=

I don't think that behavior is correct. It is= n't quite right to just remove the first block though, at least in this= case. The result in this function is already structured as a fixed-width r= esults element intended=C2=A0to be interpreted as a results string, and not= the numeric value returned. So the fix is probably upstream from this.

I am not sure what the fix=C2=A0is for this. The code= path from C-cC-c to executing the code, handling the request to the kernel= , getting results and to the output is very hard to follow for me. I would = post an issue at=C2=A0https://github.com/nnicandro/emacs-jupyter/issues.
= =C2=A0
John
-----------------------------------
Professor John Kitchin (he/him/his)=
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Me= llon University
Pittsburgh, PA 15213
412-268-7803


On Sat, Sep 4, 2021 at 4:22 PM Rafael <rvf0068@gmail.com> wrote:

I am using emacs-jupyter (https://github.com/nnicandro/ema= cs-jupyter),
and I have just noticed that results from a block are not sent to
another block. I think it has to do with this issue
https://github.com/nnicandro/emacs-jupyter/issu= es/222. Can somebody
suggest a workaround? (I actually want to use the output from a kernel
different from python, but since the problem happens also with the python kernel I'm using it as an example).

=C2=A0 #+name: atest
=C2=A0 #+begin_src jupyter-python :session test
1+1
=C2=A0 #+end_src

=C2=A0 #+RESULTS: graphst
=C2=A0 : 2

=C2=A0 #+begin_src python :var adjs=3Datest
adjs
=C2=A0 #+end_src

=C2=A0 #+RESULTS
=C2=A0 : nil

--000000000000f72b3805cb7c394f--