14

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.

4
  • 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 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
11

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

7
  • 6
    For some reason adding this (setq python-shell-completion-native-enable nil) to my init.el file worked, without requiring the code above. Jan 19 '18 at 21:58
  • 7
    Even on Emacs 26.1 I still get this issue. Aug 21 '18 at 12:26
  • 2
    Also on Emacs 26.2 , and this answer still works.
    – Zoe Rowa
    Apr 19 '19 at 8:33
  • 1
    @ZoeRowa It won't break on Emacs 25.2 and above, but it doesn't do anything useful (since it's just installing the version of that function from 25.2).
    – npostavs
    Apr 19 '19 at 11:12
  • 3
    same issue on Emacs 27.1... did as @GuilhermeSalomé recommended, and warnings went away.
    – midas0441
    Aug 26 '20 at 23:03
3

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
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.