0

I'm using Emacs (GNU Emacs 26.1 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.22.30) of 2019-05-11) on CentOS 8 and want to use autocompletion when coding with python.

Emacs.............: 26.1
Elpy..............: 1.35.0
Virtualenv........: None
Interactive Python: python3.8 3.8.6 (/usr/bin/python3.8)
RPC virtualenv....: rpc-venv (/home/user/.emacs.d/elpy/rpc-venv)
 Python...........: python3.8 3.8.6 (/home/user/.emacs.d/elpy/rpc-venv/bin/python3.8)
 Jedi.............: 0.18.0
 Rope.............: 0.19.0
 Autopep8.........: 1.5.7
 Yapf.............: 0.31.0
 Black............: 21.7b0
Syntax checker....: flake8 (/usr/bin/flake8)

Usually, after importing a module and writing its name, if I press <TAB>, then a buffer called *Completions* opens and I can see possible completions:

enter image description here

However, after loading a certain module of pyNastran (pyNastran.bdf.bdf), autocompletion is broken. Not only for this module but for all others too. For example, if I import numpy with import numpy as np and press <TAB> after writing np., then the first possible completion in alphabetical order is autocompleted followed by the characters ^[[0m. The buffer *Completions* does not open at all.

enter image description here

What could be the reason? How can I try to fix it?

4
  • I'm wrangling auto-completion issues in python-mode as well. Among many findings I noticed anaconda-mode halts yasnippets in company.
    – jjk
    Aug 12, 2021 at 12:04
  • Note that the characters ^[[0m (when ^[ is an escape character) is the ansi escape code for resetting colours (or other styles) in a terminal, so something is likely trying to use colours, and it may be catching your python repl off guard. Does C-h v ansi-color-for-comint-mode help?
    – phils
    Aug 12, 2021 at 12:58
  • @phils In my case it's set to true, but if I set it to nil the error still appears. I don't know how autocompletion-mode works, but I don't understand how can a certain module affect the autocompletion of different ones. Can it be that there is some non-standard character in some file of the imported module, which is then written to an autocompletion lists which therefore breaks autocomplete? I don't even know how to start debugging. I tried it on a different computer with Debian and a newer version of emacs and the error is still there. @jjk Same error withanaconda-mode instead of elpy
    – Robe
    Aug 12, 2021 at 14:25
  • I don't use python or autocompletion-mode so I have no insight into that side of things; but again, the "non-standard character" appears to be an attempt to generate fancy text in the terminal. I would firstly look at the documentation for whichever programs you are using to see if there's a way to tell it not to use colour or other ansi escape codes / terminal effects.
    – phils
    Aug 12, 2021 at 14:35

0

Your Answer

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

Browse other questions tagged or ask your own question.