# Error while capturing video using opencv in WSL2

**URL:** <https://forum.opencv.org/t/error-while-capturing-video-using-opencv-in-wsl2/17138>\
**Category:** Python\
**Tags:** windows, wsl, videoio\
**Created:** [April 3, 2024, 9:14am UTC](https://forum.opencv.org/t/error-while-capturing-video-using-opencv-in-wsl2/17138 "2024-04-03T09:14:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![make](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@make](https://forum.opencv.org/u/make)\
**Post date:** [April 3, 2024, 9:14am UTC](https://forum.opencv.org/t/error-while-capturing-video-using-opencv-in-wsl2/17138/1 "2024-04-03T09:14:34Z")

</div>

**CODE**

```auto
cap = cv2.VideoCapture(0)
while True:
# Capture frame-by-frame
     ret, frame = cap.read()
     # if frame is read correctly ret is True
     if not ret:
         print("Can't receive frame (stream end?). Exiting ...")
         break
     # # Our operations on the frame come here
     gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
     # Display the resulting frame
     cv2.imshow('frame', frame)
     if cv2.waitKey(1) == ord('q'):
         break

```

**ERROR OUTPUT**

```auto
[WARN:0@10.062] global cap_v4l.cpp:1134 
tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.
Can't receive frame (stream end?). Exiting ..

```

.

i also tried to **sudo guvcview** from wsl2, and it work fine, and i can also find my devices by running **ls -al /dev/video** \*

 ![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/0/0fd8120cb342140ad4c5de3a07c87a00a987f9ee.png)
