Skip to content
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

Pylint no-member warnings in 4.5.4.58 #570

Closed
4 tasks done
robertschweizer opened this issue Oct 21, 2021 · 6 comments · Fixed by #579
Closed
4 tasks done

Pylint no-member warnings in 4.5.4.58 #570

robertschweizer opened this issue Oct 21, 2021 · 6 comments · Fixed by #579
Assignees

Comments

@robertschweizer
Copy link

robertschweizer commented Oct 21, 2021

Expected behaviour

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

Actual behaviour

For opencv-python-4.5.4.58, pylint can no longer inspect the members.

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.3.56:

$ pylint test.py --extension-pkg-whitelist=cv2

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

With opencv-python-4.5.4.58:

$ pylint test.py --extension-pkg-whitelist=cv2
************* 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
@alalek
Copy link
Member

alalek commented Oct 21, 2021

BTW, does it work with --unsafe-load-any-extension=y: https://pylint.pycqa.org/en/latest/technical_reference/c_extensions.html

@robertschweizer
Copy link
Author

Good idea, maybe the C extension name just changed. But no, with --unsafe-load-any-extension=y it also does not work.

@jaime-dangelmeier
Copy link

I also tried using the generated-members = cv2.* flag for pylint => still the same issue.

@asmorkalov
Copy link
Collaborator

Since 4.5.4.60 pylint works with OpenCV python loader correctly. Command line example:

python3 -m pylint --extension-pkg-whitelist=cv2,numpy ./contours.py

@robertschweizer
Copy link
Author

The fix for this was reverted in 5633cf3, so this bug appears again in version 4.6.0.66. Should we rename and reopen this issue or create a new one?

@pasbi
Copy link

pasbi commented Aug 10, 2022

I get the Module 'cv2' has no '*' member-pylint-error with

  • python3-opencv (4.6.0 installed with apt)
  • opencv-python (4.6.0 installed with pip)
  • ❌ self-built OpenCV (using GitHub repos opencv/opencv and opencv/opencv_contrib but not using opencv-python).
  • ✔️ The only way I found to make pylint work was to install version 4.5.5 of opencv-python with pip.

However, I'm required to build OpenCV from source for technical reasons.
What's the charm that lets the 4.5.5 pip wheel work with pylint and how can I apply it to my self-built OpenCV?

Build and test environment is a debian bookworm Docker container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants