Dronekit using while running the python script disarming the motors

@ hi actually am running this code am getting error automatically disarming the motors .please help me

from dronekit import connect, VehicleMode, LocationGlobalRelative
from pymavlink import mavutil
import time
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(’–connect’, default=‘’)
args = parser.parse_args()

Connect to the Vehicle

#print(‘Connecting to vehicle on: %s’ % connection_string)
print (‘Connecting to vehicle on: %s’ % args.connect)
vehicle = connect(args.connect, baud=57600, wait_ready=True)
#921600 is the baudrate that you have set in the mission plannar or qgc

Function to arm and then takeoff to a user specified altitude

def arm_and_takeoff(aTargetAltitude):

print (“Basic pre-arm checks”)

Don’t let the user try to arm until autopilot is ready

while not vehicle.is_armable:
print (" Waiting for vehicle to initialise…")

print (“Arming motors”)

Copter should arm in GUIDED mode

vehicle.mode = VehicleMode(“GUIDED”)
vehicle.armed = True

while not vehicle.armed:
print (" Waiting for arming…")

print (“Taking off!”)
vehicle.simple_takeoff(aTargetAltitude) # Take off to target altitude

Check that vehicle has reached takeoff altitude

while True:
print( " Altitude: ", vehicle.location.global_relative_frame.alt )
#Break and return from function just below target altitude.
if vehicle.location.global_relative_frame.alt>=aTargetAltitude*0.95:
print( “Reached target altitude”)

Initialize the takeoff sequence to 15m


print(“Take off complete”)

Hover for 10 seconds


print(“Now let’s land”)
vehicle.mode = VehicleMode(“LAND”)

Close vehicle object