Failure to takeoff with pymavlink

When running a SITL airplane with Mavproxy, I type the following commands at the console takeoff:
mode takeoff
arm throttle
As a result, the airplane takes off and enters a wait pattern.
I wanted to do the same with pymavlink, so I wrote the following script:

from pymavlink import mavutil
# Start a connection listening on a UDP port
the_connection = mavutil.mavlink_connection('udpin:localhost:14560')

# Wait for the first heartbeat
#   This sets the system and component ID of remote system for the link
the_connection.wait_heartbeat()
print("Heartbeat from system (system %u component %u)" % (the_connection.target_system, the_connection.target_component))
the_connection.mav.command_long_send(the_connection.target_system, the_connection.target_component , mavutil.mavlink.MAV_CMD_NAV_TAKEOFF , 25 , 0 , 0 , 0 , 0 , 0 , 100 )
the_connection.mav.command_long_send(the_connection.target_system, the_connection.target_component , mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 )

Both messages are acknowledged, the arm message succeeds, but the takeoff fails.

Capture