1 Apr 2012 01:02
Re: Python code block hangs with :session if python-mode is loaded
Richard Stanton <stanton <at> haas.berkeley.edu>
2012-03-31 23:02:04 GMT
2012-03-31 23:02:04 GMT
> If I do not have (require 'python-mode) in my init.el, the following also > works fine: > > #+begin_src python :results output :session print "%d + %d = %d" % (2, 3, > 2+3) > 2**5 > #+end_src > > #+RESULTS: > : 2 + 3 = 5 > : 32 > > However, if (require 'python-mode) is in my init.el file, pressing C-c C-c in > the second code block causes Emacs to hang with the message "Executing > python code block". I can get out by pressing C-g, but it never returns > otherwise. A quick follow-up, in case it's useful: 1) This is with org-mode 7.8.07, but the same occurred with 7.8.06, in both cases running under Emacs 23.0.94, and I get the same behavior under both OS X and Windows. 2) If I toggle debug-on-quit, here's what I see when I press C-g: Debugger entered--Lisp error: (quit) accept-process-output(#<process Python>) (while (progn (goto-char comint-last-input-end) (not (save-excursion (and (re-search-forward (regexp-quote org-babel-python-eoe-indicator) nil t) (re-search-forward comint-prompt-regexp nil t))))) (accept-process-output (get-buffer-process (current-buffer)))) (progn (goto-char (process-mark (get-buffer-process (current-buffer)))) (let ((start (point)) (end (point-max))) (setq dangling-text (buffer-substring start end)) (delete-region start end)) (input-body body) (send-wait) (send-wait) (insert org-babel-python-eoe-indicator) (send-wait) (while (progn (goto-char comint-last-input-end) (not (save-excursion (and (re-search-forward (regexp-quote org-babel-python-eoe-indicator) nil t) (re-search-forward comint-prompt-regexp nil t))))) (accept-process-output (get-buffer-process (current-buffer)))) (goto-char (process-mark (get-buffer-process (current-buffer)))) (insert dangling-text)) (unwind-protect (progn (goto-char (process-mark (get-buffer-process (current-buffer)))) (let ((start (point)) (end (point-max))) (setq dangling-text (buffer-substring start end)) (delete-region start end)) (input-body body) (send-wait) (send-wait) (insert org-babel-python-eoe-indicator) (send-wait) (while (progn (goto-char comint-last-input-end) (not (save-excursion (and (re-search-forward ... nil t) (re-search-forward comint-prompt-regexp nil t))))) (accept-process-output (get-buffer-process (current-buffer)))) (goto-char (process-mark (get-buffer-process (current-buffer)))) (insert dangling-text)) (remove-hook (quote comint-output-filter-functions) (quote my-filt))) (progn (fset (quote my-filt) (function* (lambda (text) (block my-filt (setq string-buffer (concat string-buffer text)))))) (add-hook (quote comint-output-filter-functions) (quote my-filt)) (unwind-protect (progn (goto-char (process-mark (get-buffer-process (current-buffer)))) (let ((start (point)) (end (point-max))) (setq dangling-text (buffer-substring start end)) (delete-region start end)) (input-body body) (send-wait) (send-wait) (insert org-babel-python-eoe-indicator) (send-wait) (while (progn (goto-char comint-last-input-end) (not (save-excursion (and ... ...)))) (accept-process-output (get-buffer-process (current-buffer)))) (goto-char (process-mark (get-buffer-process (current-buffer)))) (insert dangling-text)) (remove-hook (quote comint-output-filter-functions) (quote my-filt)))) (unwind-protect (progn (fset (quote my-filt) (function* (lambda (text) (block my-filt (setq string-buffer (concat string-buffer text)))))) (add-hook (quote comint-output-filter-functions) (quote my-filt)) (unwind-protect (progn (goto-char (process-mark (get-buffer-process (current-buffer)))) (let ((start (point)) (end (point-max))) (setq dangling-text (buffer-substring start end)) (delete-region start end)) (input-body body) (send-wait) (send-wait) (insert org-babel-python-eoe-indicator) (send-wait) (while (progn (goto-char comint-last-input-end) (not (save-excursion ...))) (accept-process-output (get-buffer-process (current-buffer)))) (goto-char (process-mark (get-buffer-process (current-buffer)))) (insert dangling-text)) (remove-hook (quote comint-output-filter-functions) (quote my-filt)))) (if --cl-letf-bound-- (fset (quote my-filt) --cl-letf-save--) (fmakunbound (quote my-filt))))(Continue reading)
RSS Feed