Hello Tello Pilot!
Join our DJI Tello community & remove this banner.
Sign up

Python not working with tello

IlmMubasher

New member
Joined
Mar 20, 2026
Messages
1
Reaction score
0
Hello, I need help on this: I use command prompt with the djitellopy extension and when i try to make it take off, it flies, and then immediatly lands right after and starts blinking red, even if it was fully charged. But when i control it manually using a tablet, it does not land right away. I add the following in the code:

from djitellopy import tello
t=tello.Tello()
t.connect()
t.takeoff()

Is there a bug in the code or is it a bug on the tello or is it some other issues?
 
Hello,

I have had the same issue with this pip repo. I decided to manually connect to the drone via websockets. The thing is that the documentation is very sparse and I just recently found this github repo: GitHub - cozmobotics/tellTello: a console program for the Ryze Robotics Tello quadrocopter

I will try to reverse engineer it to build a more modern way to communicate with the Tello.


My python class basically looks like this:
import socket
import numpy as np

class DjiTello:
def __init__(self, video=False, log=None, verbose=False):
self.TELLO_IP = "192.168.10.1"
self.TELLO_PORT = 8889

self.TELLO_VIDEO_PORT = 11111

self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.sock.bind(('', 9000))

self.sock.settimeout(0.5)

self.log = log
self.verbose = verbose

self.rc_store=[0,0,0,0]

def _internal_log(self, msg):
if self.verbose and self.log is not None:
self.log.info(msg)

def _handle_response(self):
try:
data, server = self.sock.recvfrom(1024)
print(f"Response: {data.decode('utf-8')}")
except socket.timeout:
print(f"Timeout")

def send_command(self, command):
"""Standard-Befehle (takeoff, land), die eine Bestätigung 'ok' erfordern."""
try:
self.sock.sendto(command.encode('utf-8'), (self.TELLO_IP, self.TELLO_PORT))
# Setze einen kurzen Timeout, damit wir nicht ewig hängen
self.sock.settimeout(2.0)
data, server = self.sock.recvfrom(1024)
print(f"Response: {data.decode('utf-8')}")
except socket.timeout:
print(f"Timeout: {command}")
except Exception as e:
print(f"{e}")

def set_rc(self, side, fw, altitude, yaw):
# Werte runden und begrenzen
side = int(np.clip(side, -100, 100))
fw = int(np.clip(fw, -100, 100))
altitude = int(np.clip(altitude, -100, 100))
yaw = int(np.clip(yaw, -100, 100))

# Nur senden, wenn sich Werte geändert haben oder periodisch (optional)
command = f"rc {int(side)} {int(fw)} {int(altitude)} {int(yaw)}"
try:
self.sock.sendto(command.encode('utf-8'), (self.TELLO_IP, self.TELLO_PORT))
except Exception as e:
print(f"{e}")

def setup(self):
self.send_command("command")

def get_battery(self):
self.send_command("battery?")

def get_speed(self):
self.send_command("speed?")

def get_flight_time(self):
self.send_command("time?")

def get_wifi(self):
self.send_command("wifi?")

def get_video(self):
pass

It doesn't work perfectly yet but in the next week I will fork the tellTello github repo to have a python library that is up to date.

FYI: You certainly need the documentation to use the python class:
 

Members online

No members online now.

Forum statistics

Threads
5,822
Messages
40,517
Members
17,796
Latest member
NYCnPNW