I encountered an OSError when trying to capture a frame using the example code below.
The drone connects and responds correctly to command and streamon, but fails at get_frame_read().
import cv2
from djitellopy import Tello
tello = Tello()
tello.connect()
tello.streamon()
frame_read = tello.get_frame_read()
tello.takeoff()
cv2.imwrite("picture.png", frame_read.frame)
tello.land()
[INFO] tello.py - 129 - Tello instance was initialized. Host: '192.168.10.1'. Port: '8889'.
[INFO] tello.py - 438 - Send command: 'command'
[INFO] tello.py - 462 - Response command: 'ok'
[INFO] tello.py - 438 - Send command: 'streamon'
[INFO] tello.py - 462 - Response streamon: 'ok'
Traceback (most recent call last):
File "c:\AProjectFile\Test_Tello_ws\test_capture.py", line 8, in <module>
frame_read = tello.get_frame_read()
^^^^^^^^^^^^^^^^^^^^^^
File "C:\AProjectFile\Test_Tello_ws\.venv\Lib\site-packages\djitellopy\enforce_types.py", line 54, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\AProjectFile\Test_Tello_ws\.venv\Lib\site-packages\djitellopy\tello.py", line 421, in get_frame_read
self.background_frame_read = BackgroundFrameRead(self, address, with_queue, max_queue_len)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\AProjectFile\Test_Tello_ws\.venv\Lib\site-packages\djitellopy\tello.py", line 1049, in __init__
self.container = av.open(self.address, timeout=(Tello.FRAME_GRAB_TIMEOUT, None))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "av/container/core.pyx", line 482, in av.container.core.open
return InputContainer(_cinit_sentinel, file, format, options,
File "av/container/core.pyx", line 298, in av.container.core.Container.__cinit__
self.err_check(res)
File "av/container/core.pyx", line 318, in av.container.core.Container.err_check
return err_check(value, filename=self.name)
File "av/error.pyx", line 424, in av.error.err_check
raise cls(code, message, filename, log)
av.error.OSError: [Errno 10014] Error number -10014 occurred: 'udp://@0.0.0.0:11111'
Exception ignored in: <function Tello.__del__ at 0x000001F6B7174040>
Traceback (most recent call last):
File "C:\AProjectFile\Test_Tello_ws\.venv\Lib\site-packages\djitellopy\enforce_types.py", line 54, in wrapper
File "C:\AProjectFile\Test_Tello_ws\.venv\Lib\site-packages\djitellopy\tello.py", line 1028, in __del__
File "C:\AProjectFile\Test_Tello_ws\.venv\Lib\site-packages\djitellopy\enforce_types.py", line 54, in wrapper
File "C:\AProjectFile\Test_Tello_ws\.venv\Lib\site-packages\djitellopy\tello.py", line 1016, in end
File "C:\AProjectFile\Test_Tello_ws\.venv\Lib\site-packages\djitellopy\enforce_types.py", line 54, in wrapper
File "C:\AProjectFile\Test_Tello_ws\.venv\Lib\site-packages\djitellopy\tello.py", line 601, in streamoff
File "C:\AProjectFile\Test_Tello_ws\.venv\Lib\site-packages\djitellopy\enforce_types.py", line 54, in wrapper
File "C:\AProjectFile\Test_Tello_ws\.venv\Lib\site-packages\djitellopy\tello.py", line 480, in send_control_command
File "C:\AProjectFile\Test_Tello_ws\.venv\Lib\site-packages\djitellopy\enforce_types.py", line 54, in wrapper
File "C:\AProjectFile\Test_Tello_ws\.venv\Lib\site-packages\djitellopy\tello.py", line 436, in send_command_with_return
OSError: [WinError 6]
[project]
requires-python = ">=3.13"
dependencies = [
"backports-ssl-match-hostname>=3.7.0.1",
"djitellopy>=2.5.0",
"matplotlib>=3.10.6",
"mss>=10.1.0",
"numpy>=2.3.3",
"opencv-python>=4.11.0.86",
"pillow>=11.3.0",
"pynput>=1.8.1",
"python-dotenv>=1.1.1",
"pyyaml>=6.0.2",
]
I encountered an OSError when trying to capture a frame using the example code below.
The drone connects and responds correctly to command and streamon, but fails at get_frame_read().
Code used:
Error output:
Environment: