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.

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
    Commented Jan 18, 2017 at 18:36
  • Know when 25.2 is out?
    – 147pm
    Commented Jan 18, 2017 at 18:53
  • Maybe a month or so? You can try the pretest (25.1.91) now alpha.gnu.org/gnu/emacs/pretest
    – npostavs
    Commented Jan 18, 2017 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
    Commented Feb 21, 2017 at 19:31

4 Answers 4

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

7
  • 9
    For some reason adding this (setq python-shell-completion-native-enable nil) to my init.el file worked, without requiring the code above. Commented Jan 19, 2018 at 21:58
  • 7
    Even on Emacs 26.1 I still get this issue. Commented Aug 21, 2018 at 12:26
  • 2
    Also on Emacs 26.2 , and this answer still works.
    – Zoe Rowa
    Commented Apr 19, 2019 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
    Commented Apr 19, 2019 at 11:12
  • 4
    same issue on Emacs 27.1... did as @GuilhermeSalomé recommended, and warnings went away.
    – midas0441
    Commented Aug 26, 2020 at 23:03
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
1
  • Thank you - I would never have worked out my .initrc was what broke my *Python* repl Commented Dec 9, 2022 at 15:46
2

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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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