From mboxrd@z Thu Jan 1 00:00:00 1970 From: drymer Subject: Re: Possible bug on ob-python.el Date: Sun, 2 Oct 2016 12:04:44 +0200 Message-ID: <20161002100444.5n6jzedqjjomsekh@netbook> References: <20160929214713.zposl45ownsledjk@netbook> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2t4ltsn6gvzj5ggp" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqddi-0005g5-Nm for emacs-orgmode@gnu.org; Sun, 02 Oct 2016 06:05:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bqddd-0006KC-6w for emacs-orgmode@gnu.org; Sun, 02 Oct 2016 06:04:57 -0400 Received: from perdizione.investici.org ([94.23.50.208]:64198) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bqddc-0006Io-Qe for emacs-orgmode@gnu.org; Sun, 02 Oct 2016 06:04:53 -0400 Received: from [94.23.50.208] (perdizione [94.23.50.208]) (Authenticated sender: drymer@autistici.org) by localhost (Postfix) with ESMTPSA id 914EE1206A1 for ; Sun, 2 Oct 2016 10:04:47 +0000 (UTC) Content-Disposition: inline In-Reply-To: <20160929214713.zposl45ownsledjk@netbook> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: lista de correo de org-mode --2t4ltsn6gvzj5ggp Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Ignore this, I misunderstood some things and it works ok now. On Thu, Sep 29, 2016 at 11:47:13PM +0200, drymer wrote: >Hi, > >I'm not sure if it's a bug or if it's something I have missconfigured, but= there it goes. > >I'm using maint Org-mode version 8.3.6, release_8.3.6-4-g4835be.dirty. The= init file I'm using to debug is: > >#+BEGIN_SRC emacs-lisp >(add-to-list 'load-path "~/.emacs.d/lisp/org-mode/lisp/") >(add-to-list 'load-path "~/.emacs.d/elpa/python-mode-20160114.2307/") >(require 'python-mode) >(require 'org) >(setq py-shell-name "/usr/local/bin/python3") >(setq org-babel-python-mode 'python-mode) > >(org-babel-do-load-languages >'org-babel-load-languages >'((python . t))) >#+END_SRC > >I have a tree with the SESSION propertie set to "exercici". Under that tre= e, two source blocks: > >#+BEGIN_SRC python >import base64 >#+END_SRC > >#+BEGIN_SRC python >hex_string =3D "49276d206b696c6c696e6720796f757220627261696e206c696b652061= 20706f69736f6e6f7573206d757368726f6f6d" >print(base64.b64encode(bytes(hex_string))) >#+END_SRC > >When evaluating the first one, in the message buffer appears: "if: Buffer = *Python-set* does not exist or has no process". Also, a buffer called "*ulb= Python3*" has appeared. What it seems to happen is that the "ulb" buffer i= s created instead of the one called "Python-$sessionName". It only happens = when using python-mode set on 'org-babel-load-languages. > >I'll add the complete backtrace at the end of the e-mail. If I can add mor= e information, just ask for it. > >Thanks > >#+BEGIN_SRC emacs-lisp >Debugger entered--Lisp error: (error "Buffer *Python-set* does not exist o= r has no process") > signal(error ("Buffer *Python-set* does not exist or has no process")) > error("Buffer %s does not exist or has no process" "*Python-set*") > (if (org-babel-comint-buffer-livep session) nil (error "Buffer %s does no= t exist or has no process" session)) > (progn (if (org-babel-comint-buffer-livep session) nil (error "Buffer %s = does not exist or has no process" session)) (let ((save-match-data-internal= (match-data))) (unwind-protect (progn (save-current-buffer (set-buffer ses= sion) (let ((comint-input-filter ...)) (let* (... ... dangling-text raw) (g= oto-char ...) (let ... ... ...) (let ... ... ... ... ... ... ...) (while ..= =2E ...) (goto-char ...) (insert dangling-text) (if ... ...) (split-string = string-buffer comint-prompt-regexp))))) (set-match-data save-match-data-int= ernal (quote evaporate))))) > (let ((tmp-file (org-babel-temp-file "python-"))) (progn (if (org-babel-c= omint-buffer-livep session) nil (error "Buffer %s does not exist or has no = process" session)) (let ((save-match-data-internal (match-data))) (unwind-p= rotect (progn (save-current-buffer (set-buffer session) (let (...) (let* ..= =2E ... ... ... ... ... ... ... ...)))) (set-match-data save-match-data-int= ernal (quote evaporate))))) (org-babel-eval-read-file tmp-file)) > (cond ((eql result-type (quote output)) (mapconcat (function org-babel-tr= im) (butlast (progn (if (org-babel-comint-buffer-livep session) nil (error = "Buffer %s does not exist or has no process" session)) (let ((save-match-da= ta-internal ...)) (unwind-protect (progn ...) (set-match-data save-match-da= ta-internal ...)))) 2) "\n")) ((eql result-type (quote value)) (let ((tmp-f= ile (org-babel-temp-file "python-"))) (progn (if (org-babel-comint-buffer-l= ivep session) nil (error "Buffer %s does not exist or has no process" sessi= on)) (let ((save-match-data-internal (match-data))) (unwind-protect (progn = (save-current-buffer ... ...)) (set-match-data save-match-data-internal (qu= ote evaporate))))) (org-babel-eval-read-file tmp-file)))) > (let* ((send-wait (function (lambda nil (comint-send-input nil t) (sleep-= for 0 5)))) (dump-last-value (function (lambda (tmp-file pp) (mapc (functio= n (lambda ... ... ...)) (if pp (list "import pprint" ...) (list ...)))))) (= input-body (function (lambda (body) (mapc (function (lambda ... ... ...)) (= split-string body "[=0D\n]")) (funcall send-wait)))) (results (cond ((eql r= esult-type (quote output)) (mapconcat (function org-babel-trim) (butlast (p= rogn ... ...) 2) "\n")) ((eql result-type (quote value)) (let ((tmp-file ..= =2E)) (progn (if ... nil ...) (let ... ...)) (org-babel-eval-read-file tmp-= file)))))) (if (string=3D (substring org-babel-python-eoe-indicator 1 -1) r= esults) nil (let ((--params result-params)) (if (member "none" --params) ni= l (if (or (member "scalar" --params) (member "verbatim" --params) (member "= html" --params) (member "code" --params) (member "pp" --params) (member "fi= le" --params) (and (or ... ... ... ...) (not ...))) results (org-babel-pyth= on-table-or-string results)))))) > org-babel-python-evaluate-session("*Python-set*" "import base64" value ("= replace")) > (if session (org-babel-python-evaluate-session session body result-type r= esult-params) (org-babel-python-evaluate-external-process body result-type = result-params preamble)) > org-babel-python-evaluate("*Python-set*" "import base64" value ("replace"= ) nil) > (let* ((session (org-babel-python-initiate-session (cdr (assoc :session p= arams)))) (result-params (cdr (assoc :result-params params))) (result-type = (cdr (assoc :result-type params))) (return-val (if (and (eq result-type (qu= ote value)) (not session)) (progn (cdr (assoc :return params))))) (preamble= (cdr (assoc :preamble params))) (org-babel-python-command (or (cdr (assoc = :python params)) org-babel-python-command)) (full-body (org-babel-expand-bo= dy:generic (concat body (if return-val (format "\nreturn %s" return-val) ""= )) params (org-babel-variable-assignments:python params))) (result (org-bab= el-python-evaluate session full-body result-type result-params preamble))) = (org-babel-reassemble-table result (org-babel-pick-name (cdr (assoc :colnam= e-names params)) (cdr (assoc :colnames params))) (org-babel-pick-name (cdr = (assoc :rowname-names params)) (cdr (assoc :rownames params))))) > org-babel-execute:python("import base64" ((:comments . "") (:shebang . ""= ) (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:export= s . "code") (:results . "replace") (:hlines . "no") (:session . "set") (:re= sult-type . value) (:result-params "replace") (:rowname-names) (:colname-na= mes))) > org-babel-execute-src-block(nil) > org-babel-execute-src-block-maybe() > org-babel-execute-maybe() > org-babel-execute-safely-maybe() > run-hook-with-args-until-success(org-babel-execute-safely-maybe) > org-ctrl-c-ctrl-c(nil) > funcall-interactively(org-ctrl-c-ctrl-c nil) > call-interactively(org-ctrl-c-ctrl-c nil nil) > command-execute(org-ctrl-c-ctrl-c) >#+END_SRC --2t4ltsn6gvzj5ggp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJX8Nu7AAoJEKMH1k1d39qtVgwP/21xJpRCM9OPvIsXoEMfjFys 7Xefsf06W8NhamcHtI7ZWHS6+SK7s4LbCAeAbRsTfjjyuhT1HFY0PWg3Wi62dObd dnlqGKD2GcAcU2ywSTw9QBJgrsz62d3PFsFY8Y7qXJ2zp00rU1pVagYeg6JnFq2m 0ISQ/1VwgTn2Gj/nPPEgEMTm624oNmg0eSpYFbNODNR+SSrfI9g3J2oK6fbNZ+pS wLH5h7H9defWH0Y71OZh1uHh0TqIEUF+W/H7JaKXHGXkUxa7+mk+6eslwNEbzQFk +FxHddhHkH4wQlyRb0krETGHUiK4ag/Or1hBno0G7bH8eWZqhpEy1GwtdeCVYk8y zCQiA+rc7MNsgmPEQp1HmWvf+9OxMg9c1k+poN3lg/217brrXzhiyX5BP0gwjowP VMUUBbfI06ViJ2CIjAfzT9ibnR0eAv0iT6js1Fu+ibbCmR13Dd8b959p2zqglcyB P6fPihxs6mu6xU2fdUe/5qr3wPOBHnyBY0mi37HqUZBuF+3mm5tB1xkZAqrz0MTL i4v9doWpxpDC0rdC92WsSieSkCLDhWNt8C12xrGrKChqBp5Z9vrOgm6GsGySpza0 wuQQ0lXHX3WZfs+Dx+2VDzKG+iZItIwy6UNzTuJ/0pmdN1d6HowDZgDlLvq7+8x0 QPOXiv57cEBbYssCYrc0 =t/XN -----END PGP SIGNATURE----- --2t4ltsn6gvzj5ggp--