-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Type stubs: Missing the cv2.error class #23781
Copy link
Copy link
Closed
Description
System Information
OpenCV python: opencv_python_headless-4.7.0+772599a-cp37-abi3-win_amd64.whl
Operating System / Platform: 10.0.19045 Build 19045
Python version: 3.9.13
Detailed description
The cv2.error class is missing from the generated stubs, it's an important one to catch cv2 errors.
Steps to reproduce
import cv2
try:
cv2.VideoCapture().read()
# "error" is not a known member of module "cv2" Pylance(reportGeneralTypeIssues)
# Type of "error" is unknown Pylance(reportUnknownVariableType)
except cv2.error as error:
passRuntime:
>>> import cv2
>>> from cv2 import error
>>> cv2.error
<class 'cv2.error'>
>>> error
<class 'cv2.error'>Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)
Reactions are currently unavailable