Skip to content

'pylint' extension gives false positive E1101:no-member #220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jacleggmsr opened this issue Nov 21, 2022 · 4 comments · Fixed by #267
Closed

'pylint' extension gives false positive E1101:no-member #220

jacleggmsr opened this issue Nov 21, 2022 · 4 comments · Fixed by #267
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@jacleggmsr
Copy link

jacleggmsr commented Nov 21, 2022

Type: Bug

I made two files in a clean repo:

wrapper.py:

"""Wrapper"""

def my_f1(x_x: str):
    """?"""
    print(f"In wrapper, f1: {x_x}.")

consumer.py:

"""Module consumer.py"""
import wrapper

def main():
    """main"""
    wrapper.my_f1("hi")

if __name__ =="__main__":
    main()

then hit ctrl + s (save) on both files. Then change consumer.py to:

"""Module consumer.py"""
import wrapper

def main():
    """main"""
    wrapper.my_f1("hi")
    wrapper.my_f2("Joe")

if __name__ =="__main__":
    main()

and wrapper.py to:

"""Wrapper"""

def my_f1(x_x: str):
    """?"""
    print(f"In wrapper, f1: {x_x}.")

def my_f2(y_y: str):
    """??"""
    print(f"In wrapper, f2: {y_y}.")

Now I get a red underline message at the my_f2 call:
[{ "resource": "/c:/Users/jaclegg/src/demo/consumer.py", "owner": "_generated_diagnostic_collection_name_#5", "code": "E1101:no-member", "severity": 8, "message": "Module 'wrapper' has no 'my_f2' member; maybe 'my_f1'?", "source": "Pylint", "startLineNumber": 7, "startColumn": 5, "endLineNumber": 7, "endColumn": 18 }]

Running python -m pylint consumer.py finds no error, code runs fine. Also tried uninstalling the new pylint extension so that the python extension itself runs pylint and this works fine too (i.e. no E1101 is reported).

Extension version: 2022.6.0
VS Code version: Code 1.73.1 (6261075646f055b99068d3688932416f2346dd3b, 2022-11-09T04:27:29.066Z)
OS version: Windows_NT x64 10.0.22623
Modes:
Sandboxed: No

System Info
Item Value
CPUs Intel(R) Xeon(R) W-2155 CPU @ 3.30GHz (20 x 3312)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) undefined
Memory (System) 127.68GB (99.26GB free)
Process Argv --crash-reporter-id a0c77e88-5f28-4929-8dbe-4eb2820169e6
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593:30376534
pythonvs932:30410667
cppdebug:30492333
vscaac:30438847
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
pyindex848cf:30577861
nodejswelcome1cf:30587006
282f8724:30602487
gswce1:30612156
3d0df643:30613357
dbltrim-noruby:30604474
f6dab269:30613381

@github-actions github-actions bot added the triage-needed Issue is not triaged. label Nov 21, 2022
@eleanorjboyd eleanorjboyd removed the triage-needed Issue is not triaged. label Nov 21, 2022
@josmithua
Copy link

josmithua commented Nov 21, 2022

I'm also seeing this when using this new Pylint extension. Never had any issues with the old one, but now every time I add a function/method or change an existing one's signature, and try to use it in a different file, it reports E1101. Seems like there might be some caching issue. My current workaround is to reload VSCode, which sucks mucho...

Edit: can actually just restart the pylint server instead of reloading VS Code

@luabud
Copy link
Member

luabud commented Nov 22, 2022

Hi there, thanks for the bug report! I was able to reproduce the issue as well. We'll look into it as soon as we can. Because a lot of folks in the team are on vacation, in the meantime as a workaround it might be worth trying using our "built-in" support for linting: https://code.visualstudio.com/docs/python/linting#_enable-linting

@luabud luabud removed their assignment Nov 22, 2022
@luabud luabud added the triage-needed Issue is not triaged. label Nov 22, 2022
@MartinBernstorff
Copy link

Getting the same thing - my best guess is that it's caused by #129.

Should be fixed by the PR, but may result in way slower linting since the cache is invalidated.

@karthiknadig karthiknadig added bug Issue identified by VS Code Team member as probable bug and removed triage-needed Issue is not triaged. labels Jan 5, 2023
@karthiknadig
Copy link
Member

Duplicate of #129

Pylint 2.16 or greater has --clear-cache-post-run=y flag to help with these scenarios. This particularly occurs when running pylint in server like mode as we do in this extension. Hopefully that flag will help resolve this issue.

Extension will add this flag via #267

@karthiknadig karthiknadig closed this as not planned Won't fix, can't repro, duplicate, stale Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants