4

I am a complete newbie when it comes to emacs. I've got this problem with my 25.2.1 emacs running on Windows 10. Trying to run a python code results in the following error.

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

This problem has been discussed at this forum before in the following link Your ‘python-shell-interpreter’ doesn’t seem to support readline

I have tried all the tricks stated in that link but have had no success

(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 "_"))))

Do you have any suggestions for me?

funny
  • 101
  • 1
  • 2
  • 8

2 Answers2

5

The links you were reading are mostly about macOS and/or Emacs 25.1 and earlier.

Unfortunately, the "native" completion won't work under Windows, as it lacks PTYs.

So you should do (setq python-shell-completion-native-disabled-interpreters '("python")) to suppress the warning, and accept the "fallback" completion method without further noise.

npostavs
  • 9,033
  • 1
  • 21
  • 53
  • What should I do if I am using `python3`: I do still get an error message as follows: `import codecs, os;__pyfile = codecs.open('''/var/folders/mx/m3c2fd193h169gg6nd5x3p480000gn/T/pyo08Hj3''', encoding='''utf-8''');__code = __pyfile.read().encode('''utf-8''');__pyfile.close();os.remove('''/var/folders/mx/m3c2fd193h169gg6nd5x3p480000gn/T/pyo08Hj3''');exec(compile(__code, '''/Users/alper/code/string.py''', 'exec'));` @npostavs – alper Jun 21 '20 at 18:46
0

Known problem and some solution might be found here

https://github.com/jorgenschaefer/elpy/issues/887

funny
  • 101
  • 1
  • 2
  • 8
  • It would be wise to check out following comment as well: https://github.com/jorgenschaefer/elpy/issues/1550#issuecomment-574512892 – alper Jun 21 '20 at 18:51