D
D
Drovosek012019-02-17 21:38:44
Python
Drovosek01, 2019-02-17 21:38:44

Why doesn't pylint see classes in modules?

There is the following code:

import sys
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtGui import QIcon

class Example(QWidget):
    def __init__(self):
        super().__init__()
        self.initUi()

    def initUi(self):
        self.setGeometry(300,300,300,220)
        self.setWindowTitle('Icon')
        self.setWindowIcon(QIcon('camera-96.png'))

        self.show()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())

I am writing in VSCode with the Python extension installed, using pylint as a linter.
Pylint gives out as errors that in the lines from ... import ... it did not find import names.
5c69aa25ccf56611474982.png
How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Rakhmaev, 2020-09-17
@rahmaevao

This happens if the package being imported is not in the PATH of the particular interpreter you are using (venv, external....). Pylint sometimes does not see the paths in which these pacts would be included when the script is executed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question