Pylint does not find relative imports

linting
python

#1

With Cloud9, Pylint is unable to find relative imports.

If I run Pylint by myself, it works:

fnkr:~/workspace $ pylint -r n app/user/models.py 
No config file found, using default configuration
************* Module models
C:  1, 0: Missing module docstring (missing-docstring)
C:  1, 0: Missing class docstring (missing-docstring)
C:  1, 0: Old-style class defined. (old-style-class)
W:  1, 0: Class has no __init__ method (no-init)
R:  1, 0: Too few public methods (0/2) (too-few-public-methods)

Here is a sample workspace: https://ide.c9.io/fnkr/pylint-relative-imports
Workspace as zip: https://gist.github.com/fnkr/7a42def2e7c655229246/raw/workspace.zip


#2

Thanks for reporting. We’ll have a look!


#3

@fnkr we investigated this issue. It appears Pylint has issues linting unsaved files when it comes to relative imports. We’re currently working with temporary files as it doesn’t support stdin, but Pylint has an issue with relative imports if the temporary file is hidden or in a different directory. Right now we disabled the import errors as they’re not helpful like this, but we hope to come to a different solution.


#4

@lennartcl You could try this: https://github.com/PyCQA/pylint/issues/795#issuecomment-183422974