'(-215:Assertion failed) number < max_number in function 'cv::icvExtractPattern' error?

I'm trying to run this python script as an exe file - using pyinstaller, and it raise me this error:

[ERROR:0] global C:\projects\opencv-python\opencv\modules\videoio\src\cap.cpp (415) cv::VideoWriter::open VIDEOIO(CV_IMAGES): raised OpenCV exception: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\videoio\src\cap_images.cpp:267: error: (-215:Assertion failed) number < max_number in function 'cv::icvExtractPattern'

When I'm running it as a python script, it works well. the python script:

SCREEN_SIZE = (1920, 1080)
FPS = 20.0
fourcc = cv2.VideoWriter_fourcc(*"XVID")
out = cv2.VideoWriter("output.avi", fourcc, FPS, SCREEN_SIZE)

I'm using pyinstaller in the command line:

pyinstaller --onefile python_script.py

what should I change to make it work?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source