opencv / opencv/opencv-python

Pylint no-member and no-name-in-module warnings since version 4.6.0.66

Open
#824 7 comments 9 reactions 1 assignee View on GitHub

@asmorkalov is already working on this.

Since Jan 6, 2024.

Dominant language
Python
Stars
5.4k
Forks
1k
Avg merge
22h 17m
Merged PRs (30d)
3

Description

Note: Previously reported in #570, probably very related to #676.

Expected behaviour

Pylint was previously able to inspect cv2 member existence with the extension-pkg-whitelist parameter.

Actual behaviour

For opencv-python-4.6.0.66 (including the latest 4.7.0.72), pylint cannot inspect the members.

Workarounds
  1. Use older opencv-python version (e.g. 4.5.5.64)
  2. Set the generated-members=cv2.* pylint option (Use import cv2, not from cv2 import ..., suggested in https://github.com/pylint-dev/pylint/issues/2426)
Steps to reproduce

On Windows 10, Python 3.8 64bit, using Pylint 2.11.1:

"""Test module test.py"""
from cv2 import getStructuringElement, MORPH_ELLIPSE

a = getStructuringElement(MORPH_ELLIPSE, (3, 3))

With opencv-python-4.5.5.64:

$ pylint test.py --extension-pkg-whitelist=cv2 --unsafe-load-any-extension=y

-------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 5.00/10, +5.00)

With opencv-python-4.6.0.66 and the latest 4.7.0.72.:

$ pylint test.py --extension-pkg-whitelist=cv2 --unsafe-load-any-extension=y
************* Module test
test.py:2:0: E0611: No name 'getStructuringElement' in module 'cv2' (no-name-in-module)
test.py:2:0: E0611: No name 'MORPH_ELLIPSE' in module 'cv2' (no-name-in-module)

----------------------------------------------------------------------
Your code has been rated at -40.00/10 (previous run: 10.00/10, -50.00)
Issue submission checklist
  • This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
  • I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
  • The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
  • I'm using the latest version of opencv-python

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.