-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Lib specific 💅This affect the code from a particular libraryThis affect the code from a particular libraryNeeds investigation 🔬A bug or crash where it's not immediately obvious what is happenningA bug or crash where it's not immediately obvious what is happenning
Description
Bug description
pylint
gives a E0712
catching-non-exception
error on macOS Sonoma, but not on Linux.
Create the following file example.py
:
"""Example file to show pylint error"""
import cv2
try:
pass
except cv2.error:
pass
And the configuration from the section below to avoid no-member
errors opencv/opencv-python#570.
I first saw this on GitHub Actions, and I can reproduce no error by running:
$ docker run -it -v .:/code python bash
root# pip install opencv-python pylint
root# cd /code
root# pylint example.py
The difference is a problem because I either get useless-suppression / I0021
or catching-non-exception
.
Configuration
pyproject.toml
:
[tool.pylint]
[tool.pylint.'MASTER']
extension-pkg-whitelist = [
'cv2',
]
[tool.pylint.typecheck]
generated-members = ["cv2.*"]
Command used
pylint example.py
Pylint output
macOS:
************* Module example
example.py:7:7: E0712: Catching an exception which doesn't inherit from Exception: cv2.error (catching-non-exception)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)
Linux:
------------------------------------
Your code has been rated at 10.00/10
Expected behavior
No error on either platform.
Error on both platforms is preferable to the current state.
Pylint version
macOS:
pylint 3.0.3
astroid 3.0.2
Python 3.12.1 (main, Dec 7 2023, 20:45:44) [Clang 15.0.0 (clang-1500.0.40.1)]
Linux:
pylint 3.0.3
astroid 3.0.2
Python 3.12.1 (main, Dec 19 2023, 16:44:02) [GCC 12.2.0]
OS / Environment
macOS: Apple M2, Sonoma 14.2
Linux: Debian GNU/Linux 12 (bookworm)
Additional dependencies
opencv-python==4.8.1.78
Metadata
Metadata
Assignees
Labels
Lib specific 💅This affect the code from a particular libraryThis affect the code from a particular libraryNeeds investigation 🔬A bug or crash where it's not immediately obvious what is happenningA bug or crash where it's not immediately obvious what is happenning