2

When installing opencv-contrib-python pylint does not recognize the submodules of the main cv2 module (related but not identical: PyLint not recognizing cv2 members).

For instance, consider:

from cv2 import aruco
print(aruco.DICT_4X4_100)

Running pylint with --extension-pkg-whitelist=cv2,cv2.aruco gives the following message:

[pylint] Instance of 'module' has no 'DICT_4X4_100' member [E1101]

However, the code is perfectly valid and runs correctly and even Python for VSCode is able to offer autocomplete for the aruco sub-module members. Also - since cv2 is on the whitelist, pylint does recognize direct members of the cv2 module (e.g. cv2.imshow etc.)

Can Pylint be configured to recognize the native sub-modules somehow?

stav
  • 1,497
  • 2
  • 15
  • 40

1 Answers1

0

in ~/.pylintrc, add cv2.* after

generated-members=

which became

generated-members=cv2.*

then the errors should be disappeared

Cydiater
  • 9
  • 1
  • 2