From: drymer <drymer@autistici.org>
To: lista de correo de org-mode <emacs-orgmode@gnu.org>
Subject: Possible bug on ob-python.el
Date: Thu, 29 Sep 2016 23:47:13 +0200 [thread overview]
Message-ID: <20160929214713.zposl45ownsledjk@netbook> (raw)
[-- Attachment #1: Type: text/plain, Size: 6428 bytes --]
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 tree, two source blocks:
#+BEGIN_SRC python
import base64
#+END_SRC
#+BEGIN_SRC python
hex_string = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d"
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 is 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 more information, just ask for it.
Thanks
#+BEGIN_SRC emacs-lisp
Debugger entered--Lisp error: (error "Buffer *Python-set* does not exist or 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 not 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 session) (let ((comint-input-filter ...)) (let* (... ... dangling-text raw) (goto-char ...) (let ... ... ...) (let ... ... ... ... ... ... ...) (while ... ...) (goto-char ...) (insert dangling-text) (if ... ...) (split-string string-buffer comint-prompt-regexp))))) (set-match-data save-match-data-internal (quote evaporate)))))
(let ((tmp-file (org-babel-temp-file "python-"))) (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 session) (let (...) (let* ... ... ... ... ... ... ... ... ...)))) (set-match-data save-match-data-internal (quote evaporate))))) (org-babel-eval-read-file tmp-file))
(cond ((eql result-type (quote output)) (mapconcat (function org-babel-trim) (butlast (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 ...)) (unwind-protect (progn ...) (set-match-data save-match-data-internal ...)))) 2) "\n")) ((eql result-type (quote value)) (let ((tmp-file (org-babel-temp-file "python-"))) (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-match-data save-match-data-internal (quote 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 (function (lambda ... ... ...)) (if pp (list "import pprint" ...) (list ...)))))) (input-body (function (lambda (body) (mapc (function (lambda ... ... ...)) (split-string body "[\r\n]")) (funcall send-wait)))) (results (cond ((eql result-type (quote output)) (mapconcat (function org-babel-trim) (butlast (progn ... ...) 2) "\n")) ((eql result-type (quote value)) (let ((tmp-file ...)) (progn (if ... nil ...) (let ... ...)) (org-babel-eval-read-file tmp-file)))))) (if (string= (substring org-babel-python-eoe-indicator 1 -1) results) nil (let ((--params result-params)) (if (member "none" --params) nil (if (or (member "scalar" --params) (member "verbatim" --params) (member "html" --params) (member "code" --params) (member "pp" --params) (member "file" --params) (and (or ... ... ... ...) (not ...))) results (org-babel-python-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 result-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 params)))) (result-params (cdr (assoc :result-params params))) (result-type (cdr (assoc :result-type params))) (return-val (if (and (eq result-type (quote 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-body:generic (concat body (if return-val (format "\nreturn %s" return-val) "")) params (org-babel-variable-assignments:python params))) (result (org-babel-python-evaluate session full-body result-type result-params preamble))) (org-babel-reassemble-table result (org-babel-pick-name (cdr (assoc :colname-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") (:exports . "code") (:results . "replace") (:hlines . "no") (:session . "set") (:result-type . value) (:result-params "replace") (:rowname-names) (:colname-names)))
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next reply other threads:[~2016-09-29 21:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-29 21:47 drymer [this message]
2016-10-02 10:04 ` Possible bug on ob-python.el drymer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160929214713.zposl45ownsledjk@netbook \
--to=drymer@autistici.org \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).