19

I've got this problem with my 25.1 and Python 3.5 on Ubuntu 16.10, but I don't see it being solved anywhere. Wondering what the latest status was. Reproducing:

> emacs -Q --eval '(setq python-shell-interpreter "python3")'

then

M-x run-python gives

Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support readline, yet ‘python-shell-completion-native’ was t and "python3" is not part of the ‘python-shell-completion-native-disabled-interpreters’ list.  Native completions have been disabled locally.

I saw one idea where an M-x find-function python-shell-completion-native-try would pull up the function from deep (/usr/local/share/emacs/25.1/lisp/progmodes/python.el.gz and the very last line was supposed to be nil "_"))) and not nil ""))). Another conversation here talks about changing inputrc

I switched to another user and I was able to use `run-python' without any warnings. Turns out it was my readline settings. Bash 4.3 added a new readline feature: "set colored-stats on" which I had in .inputrc Removing that line fixed my issue, I think this should be reproducible for all.

Anybody know what the latest is on this? BTW, running Python2 ((setq org-babel-python-command "python2")) doesn't have this problem.

147pm
  • 2,907
  • 1
  • 18
  • 39
  • The Emacs bug you linked to is marked as solved for 25.2 (not released yet), so you should expect it to still be present in 25.1. You can try the pretest version (25.1.9x). – npostavs Jan 18 '17 at 18:36
  • Know when 25.2 is out? – 147pm Jan 18 '17 at 18:53
  • Maybe a month or so? You can try the pretest (25.1.91) now http://alpha.gnu.org/gnu/emacs/pretest/ – npostavs Jan 18 '17 at 19:20
  • I’ve got the same symptoms ("Your ‘python-shell-interpreter’ doesn’t seem to support readline") running Python 3.6.0 and GNU Emacs 25.2 RC1 on Windows 10, so either the problem isn’t solved yet, or maybe it is a different problem? – Martin Feb 21 '17 at 19:31

4 Answers4

12

If you don't want to get a 25.2 rc, you can apply the bug fix by adding this to your init.el file:

(with-eval-after-load 'python
  (defun python-shell-completion-native-try ()
    "Return non-nil if can trigger native completion."
    (let ((python-shell-completion-native-enable t)
          (python-shell-completion-native-output-timeout
           python-shell-completion-native-try-output-timeout))
      (python-shell-completion-native-get-completions
       (get-buffer-process (current-buffer))
       nil "_"))))

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25753#44

npostavs
  • 9,033
  • 1
  • 21
  • 53
5

I had this disturbing warning in Emacs 25.1 too.

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24401 has proper solution to enable colored-stats only for Bash:

$ cat ~/.inputrc
$if Bash
set colored-stats on
$endif
gavenkoa
  • 3,352
  • 19
  • 36
2

I had this issue in Emacs 27 and Python 3.9, on Debian 11. My workaround was to wrap my ~/.inputrc with $if term=dumb, $else, and $endif. This disables all my psql and python tricks when run inside comint.el (which sets $TERM=dumb), but keeps them when run directly in a regular terminal.

twb
  • 21
  • 1
1

A pip install readline did the job for me. Completion within python code blocks is pretty neat to have...

Red Pill
  • 111
  • 1