GNU bug report logs -
#29592
25.3; python does not print input or output in the inferior process
Previous Next
Reported by: Alex Branham <alex.branham <at> gmail.com>
Date: Wed, 6 Dec 2017 19:00:02 UTC
Severity: wishlist
Merged with 30632
Found in versions 25.3, 26.0.91
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
The GitHub ticket below for elpy also mentions this issue and includes some
"quick-and-dirty" that does seem to address the issue. The code works,
but I get an extra line break in the REPL when evaluating lines other
than the first line of the buffer.
https://github.com/jorgenschaefer/elpy/issues/924#issuecomment-314922197
> This is not an elpy issue, it also occurs with plain python-mode. It
> seems to be caused by certain versions of Python only. A quick-and-dirty
> fix is (in .emacs):
>
> (defun python-shell-append-to-output (string)
> (let ((buffer (current-buffer)))
> (set-buffer (process-buffer (python-shell-get-process)))
> (let ((oldpoint (point)))
> (goto-char (process-mark (python-shell-get-process)))
> (insert string)
> (set-marker (process-mark (python-shell-get-process)) (point))
> (goto-char oldpoint))
> (set-buffer buffer)))
>
> (defadvice python-shell-send-string
> (around advice-python-shell-send-string activate)
> (interactive)
> (let* ((append-string1
> (if (string-match "import codecs, os;__pyfile = codecs.open.*$" string)
> (replace-match "" nil nil string)
> string))
> (append-string2
> (if (string-match "^# -\\*- coding: utf-8 -\\*-\n*$" append-string1)
> (replace-match "" nil nil append-string1)
> append-string1))
> (append-string
> (if (string-match "^\n*$" append-string2)
> (replace-match "" nil nil append-string2)
> append-string2)))
> (python-shell-append-to-output
> (concat (string-trim-right append-string) "\n")))
> (if (called-interactively-p 'any)
> (call-interactively (ad-get-orig-definition 'python-shell-send-string))
> ad-do-it))
This bug report was last modified 3 years and 77 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.