简体   繁体   中英

VS code shows pylint import errors while 'go to definition' works

I have a project structure of:

common (folder)
  |- __init__.py
  |- model.py
  |- monitoring.py
     |- class MyLogger

on the model.py file i have this line and the following error: from common.monitoring import MyLogger

errors:

No name 'monitoring ' in module 'common'    pylint (no-name-in-module).
Unable to import 'common.monitoring'    pylint(import-error).

import monitoring hits the same errors.

in practice:

  1. the code runs smoothly
  2. F12 (go to definition) works and goes the MyLogger.

I searched across the web and couldn't find how to configure VS code well to eliminate those errors.

So i found eventually the answer: How do I disable pylint unused import error messages in vs code

Bottom line: add to the settings.json:

"python.linting.pylintArgs": [
        "--max-line-length=100",
        "--disable=W0142,W0403,W0613,W0232,R0903,R0913,C0103,R0914,C0304,F0401,W0402,E1101,W0614,C0111,C0301"
    ],

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM