python-language-server icon indicating copy to clipboard operation
python-language-server copied to clipboard

'No parent module' error

Open dodomorandi opened this issue 7 years ago • 3 comments

I am having a strange issue with a false positive error.

I have a typical Python3 project with setup.py and the package directory, with all modules inside and, obviously, the __init__.py file. Whenever I try to import a sibling module, in the form of from . import module, I got the error No parent module -- cannot perform relative import. If things are imported from the module in the form of from .module import func, everything is fine. From the logs I can see that the error is obtained by pycodestyle. However, I tried to run the tool from the shell, and the error is not shown.

I am using NeoVim with LanguageClient-neovim, if it could be relevant.

dodomorandi avatar Mar 21 '18 16:03 dodomorandi

I got this error too.

allan-simon avatar Jun 02 '18 13:06 allan-simon

I suspect the internal call to pycodestyle strips away the remaining project context and thus this error appears.

languitar avatar Jun 02 '18 14:06 languitar

I think it's caused by the pyls-mypy plugin. See the issue I reported there: https://github.com/tomv564/pyls-mypy/issues/36.

bbc2 avatar Dec 02 '19 15:12 bbc2