Jupyter suppresses warnings coming from C++ files
Author: nicolas-joffreCreated Sep 17, 2026Updated Sep 17, 2026
Labelsbugstatus:Needs Triage
Description
Warnings that should normally be shown when executing incorrect code do not appear when the code is executed from a Jupyter notebook.
Reproduce
Execute the following code in a Jupyter notebook
import cv2
import numpy as np
with cv2.VideoWriter("video.avi", cv2.VideoWriter_fourcc(*"MJPG"), 0, (1, 1), 0) as video:
print(video.write(np.array([1])))When executed, the only thing printed is False
Expected behavior
To see the same thing as when executed from the IPython console, i.e.
[ WARN:[email protected]] global cap.cpp:778 cv::VideoWriter::open VIDEOIO(CV_IMAGES): raised OpenCV exception:
OpenCV(5.0.0) D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_images.cpp:423: error: (-215:Assertion failed) !filename_pattern.empty() in function 'cv::CvVideoWriter_Images::CvVideoWriter_Images'
[ WARN:[email protected]] global cap.cpp:778 cv::VideoWriter::open VIDEOIO(CV_MJPEG): raised OpenCV exception:
OpenCV(5.0.0) D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_mjpeg_encoder.cpp:441: error: (-215:Assertion failed) fps >= 1 in function 'cv::mjpeg::MotionJpegWriter::open'
FalseContext
- Operating System and version: Windows 11
- Browser and version: Firefox 155
- JupyterLab version: 4.6.3
Paste the output from running `jupyter troubleshoot` from the command line here.
You may want to sanitize the paths in the output.
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Paste the output from your browser Javascript console here, if applicable.Source: jupyterlab/jupyterlab