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

Tello.py on Pythonista


Well-known member
Nov 29, 2018
Reaction score
I am trying to use microlinux/tello to talk to a Tello drone on Pythonista (ios app) but not getting too far.

After import tello, I try (in console):

drone = tello.Tello('',8888)

drone = tello.Tello('',8888)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/mobile/Containers/Shared/AppGroup/B86CEE4E-E4A9-4BB4-9CA7-6E13BDA2C2A4/Pythonista3/Documents/tello/tello.py", line 60, in __init__
raise RuntimeError('Tello rejected attempt to enter command mode')
RuntimeError: Tello rejected attempt to enter command mode
The ios says the device address is 10.2 and the router is 10.1. The result of at 8888 is as above. The result with at 8889 is:

drone = tello.Tello('',8889)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/mobile/Containers/Shared/AppGroup/B86CEE4E-E4A9-4BB4-9CA7-6E13BDA2C2A4/Pythonista3/Documents/tello/tello.py", line 52, in __init__
self.socket.bind((local_ip, local_port))
OSError: [Errno 49] Can't assign requested address
I tried Tello3.py as suggested by @an3k and it worked. At least it understood takeoff and landing so communication works. Not sure what the msg format should be to move forward, back, etc. but I presume that is documented somewhere (in the SDK?). I doubt that Pythonista can deal with the streaming video or photos but at least this is a step forward.
I'll try the microlinux/tello later when I'm at my notebook.

The commands and format possible with the Tello3.py are shown in the SDK PDF https://terra-1-g.djicdn.com/2d4dce...Tello/Tello SDK Documentation EN_1.3_1122.pdf

It's basically up x, down x, forward x, right x, back x, left x (where x is in cm and within 20 - 500) or cw y, ccw y (where y is in degrees).

The PDF also tells you on how you can receive the video feed; but you have to develop the udp listener and a window to actually see it yourself.
Last edited:
Hmm...I tried command and the CODE you show but that gave no result. i must be getting the syntax wrong since takeoff and land work.
After takeoff what about these?
up 50
forward 100
cw 180
forward 100
down 50
hehe...won't takeoff now. I suspect the battery is too low. I finally managed to get it to take the battery? command and it said 8 so I am charging it and will report back.
Still trying to get microlinux/tello to work but I must have the addresses wrong as I continue to get the errors above. Can anyone get this script to work?
I tried it now and got the same results as you. I'm new to Python but did PHP and some Perl years ago. I was able to solve the problem.

Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tello
>>> import time
>>> drone = tello.Tello('', 8888, imperial=False)
>>> drone.get_battery()
>>> drone.get_speed()

To get it working you have to modify the code of tello.py

Change line 59 from
if self.send_command('command') != 'OK':
if self.send_command('command') != 'ok':

Ignore how I got it working, I just used the exact example shown on the website. You don't have to import time to get it working, it's just changing line 59 that causes the problem :)
Last edited:
@an3k Thanks for finding that. I can now takeoff; however, I find that the drone will land itself after 10 seconds or so without any commands. Also, I have tried using other commands to move up,down, forward and backward and in general I get something like:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/mobile/Containers/Shared/AppGroup/B86CEE4E-E4A9-4BB4-9CA7-6E13BDA2C2A4/Pythonista3/Documents/site-packages-2/tello/tello.py", line 268, in move_up
return self.move('up', distance)
File "/private/var/mobile/Containers/Shared/AppGroup/B86CEE4E-E4A9-4BB4-9CA7-6E13BDA2C2A4/Pythonista3/Documents/site-packages-2/tello/tello.py", line 184, in move
return self.send_command('%s %s' % (direction, distance))
File "/private/var/mobile/Containers/Shared/AppGroup/B86CEE4E-E4A9-4BB4-9CA7-6E13BDA2C2A4/Pythonista3/Documents/site-packages-2/tello/tello.py", line 296, in send_command
raise RuntimeError('No response to command')
RuntimeError: No response to command
I do get the same. Looks like the python script isn't perfectly working with the newer firmware versions anymore.

>>> drone.get_battery()
>>> drone.takeoff()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Ben\AppData\Local\Programs\Python\Python37-32\lib\tello.py", line 349, in takeoff
    return self.send_command('takeoff')
  File "C:\Users\Ben\AppData\Local\Programs\Python\Python37-32\lib\tello.py", line 296, in send_command
    raise RuntimeError('No response to command')
RuntimeError: No response to command
>>> drone.get_battery()
>>> drone.get_battery()
>>> drone.get_battery()
>>> drone.land()

However, the drone was always responding to my commands, it was just the script not showing correct data.

I already published my bugfix to github and I noticed others have also published fixes and improvements to the code but since June the developer haven't made any changes so probably someone else has to Fork that project and implement all the improvements and fixes.
I do have the new firmware and the script undoubtedly needs to be updated. I like this script mostly because it runs under Pythonista on IOS and some other scripts I have seen have incompatible dependencies.
It is interesting how it will takeoff but then it spontaneously lands after 18 seconds. Is the firmware looking for something to show it is stilll being controlled?
I read somewhere that this is a normal behavior. If it doesn't receive commands within 15 seconds after takeoff it will land.
I think it may be what Ryze calls "failsafe protection". Given this feature, how does one write a python program that makes the drone hover in place for a period longer than 15s?
I think this failsafe is only active directly after takeoff. If you tell Tello to go up 50 and down 50 it hovers in the same position as directly after takeoff but does not land after 15 seconds again. This or what briest said :)
I just tested to see if that was true. After takeoff I had the drone move backward. It spontaneously landed after 15 s. (using tello.py on latest firmware)

Members online

No members online now.

Forum statistics

Latest member