all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Possible bug on ob-python.el
@ 2016-09-29 21:47 drymer
  2016-10-02 10:04 ` drymer
  0 siblings, 1 reply; 2+ messages in thread
From: drymer @ 2016-09-29 21:47 UTC (permalink / raw)
  To: lista de correo de org-mode

[-- 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Possible bug on ob-python.el
  2016-09-29 21:47 Possible bug on ob-python.el drymer
@ 2016-10-02 10:04 ` drymer
  0 siblings, 0 replies; 2+ messages in thread
From: drymer @ 2016-10-02 10:04 UTC (permalink / raw)
  To: lista de correo de org-mode

[-- Attachment #1: Type: text/plain, Size: 6589 bytes --]

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 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 --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-02 10:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-29 21:47 Possible bug on ob-python.el drymer
2016-10-02 10:04 ` drymer

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.