Open kkew3 opened 5 years ago
This issue has been automatically marked as stale because it has not had activity in the last 60 days.
I have the same problem.
This issue has been automatically marked as stale because it has not had activity in the last 60 days.
I have the same problem to PyCharm 2020.01 PyLint 0.12.2.
I was able to resolve this by adding PYTHONPATH=./src
to my .env
file.
Context: I am also using pipenv
to allow Automatic Loading of .env
.
I also have the same problem.
I have the same problem
I have same problem
Step 1: Are you in the right place?
This is highly related to https://github.com/leinardi/pylint-pycharm/issues/10, but it has been closed.
Step 2: Describe your environment
v0.11.0
2018.3.5 (Community Edition)
2.3.1
Step 3: Describe the problem:
Pylint run by the plugin doesn't put
source roots
into PYTHONPATH. Therefore, allimport
statements involving project files triggerno-name-in-module
error.Steps to reproduce:
${some_directory}/xxx
, using virtualenv under${some_directory}/xxx/rt
; activate the virtualenv bycd ${some_directory}/xxx; . rt/bin/activate
.pip install pylint
${some_directory}/xxx/src
, and mark it assource root
in pycharm. Create two files,${some_directory}/xxx/src/utils.py
, filled withdef f(x): return x + 1
, and${some_directory}/xxx/src/hello.py
, filled withimport utils; def hello(n): print('hello:', utils.f(n))
. (The code is written in one line for clarity. See the actual layout in screenshot below)${some_directory}/xxx/src/hello.py
.Observed Results:
${some_directory}/xxx
, with the virtualenvrt
activated, runPYTHONPATH="$(pwd)/src" pylint src/hello.py
. It doesn't reportmodule 'utils' has no 'f' member
. However, the Pylint plugin does report.Expected Results:
module xxx has no yyy member
in such case, and should behave the same as the terminalpylint
.Relevant Code:
src/hello.py
def greeting(n): print('hello:', utils.f(n))
Event Log: Yes there's exclamation mark around
Event Log
in the screenshot. However I removed the test project before I saw the comment about pasting the event log. I tend to believe the problem has been partially fixed. IMHO the scanning of source roots might not be done every time before running pylint. I also tested removing the marksource root
onsrc
. While pycharm inspection immediately underlinesimport utils
inhello.py
, there's no response from the pylint plugin (after it has stopped reporting the error).