Attribute Error : 'videoCapture' object has no attribute 'isOpened'

I am trying to record video in a python program. I can see the video on my screen but when I check the video attribute “video.isOpened()” I get an error that says videoCapture has no attribute ‘isOpened’. I am using opencv-python (Version and am using opencv-contrib-python- Can anyone point me in the right direction toward solving this problem? I have tried Google but to no avail. Thanks.

please show exact code snippet
(it’s probably something silly)


please do NOT install both, only the latter !

I removed opencv-python and that seems to have fixed the issue. Would it be too difficult to explain why only one of those modules should be installed? I am quite happy to look at documentation and have done so but I did not see any mention of having one or the other installed. The whole pip install opencv-python and importing the module as cv2 is confusing. Is there any source that can give clarity to this? Thanks.

both are called cv2, and python can only load one of them at a time.
(opencv-contrib-python is a “superset” of opencv-python)

Wow, how unfortunate. Thanks for the help.

As berak wrote You cannot install both :
[### Installation and Usage

  1. If you have previous/other manually installed (= not installed via pip ) version of OpenCV installed (e.g. cv2 module in the root of Python’s site-packages), remove it before installation to avoid conflicts.](opencv-contrib-python · PyPI)