0

I am using coc.nvim in neovim together with Pylint.

If I try to import my own module e.g. src.reverse_linked_list or an installed module like selenium, CoC displays the error message

[pylint E0401] [E] Unable to import 'xxxxx' (import-error)

double checked that init.py is in my directories

Running the code does not lead to any errors

Does anyone know how to fix this?

manzosk3
  • 1
  • 3

1 Answers1

0

The python path need to be the same when running pylint inside neovim vs when running the code. The import using src.reverse_linked_list is suspicious in this regard, src is not generally used in the import.

Pierre.Sassoulas
  • 3,733
  • 3
  • 33
  • 48
  • I changed the folder name and tried problems.reverse_linked_list but I still have the same error On the question of the python path, someone suggested to run `:CocCommand python.setInterpreter` `Select pythonPath, current: /Users/manzosk3/bin/Environments/py3_env/bin/python:` I could be wrong but it seems to me that from the list of pythonPaths to select, it is set to the correct one (I'm using a virtual environment) but I still get the error. – manzosk3 Feb 28 '22 at 21:17
  • Maybe a first step to identify what's wrong would be to install pylint with pip in a virtualenv and use pylint without neovim to see if it works when launched from the same directory than when you launch the python code. – Pierre.Sassoulas Mar 01 '22 at 08:50