During the drone programming primer, within the video titled " Function to Connect Python Script to SITL Drone part1," I copied the code shown in the video almost exactly, with only a few changes for my own organization. When I run connection_template.py (using “python connection_template.py --connect 127.0.0.1:14550” within my dronekit directory, it returns the following error:
From my own research I believe this may be a python version error? I’m not entirely sure how it occurred however, as I followed the exact steps laid out in the video.
Here is the “connection_template.py” that I wrote (copied ) from the video.
#Dependencies below
from dronekit import connect, VehicleMode, LocationGlobalRelative, APIException
import time
import socket
import exceptions
import math
import argparse#Functions below
def connectUAV():
parser = argparse.ArgumentParser(description=‘commands’)
parser.add_argument(’–connect’)
args = parser.parse_args()
connection_string = args.connect
vehicle = connect(connection_string,wait_ready=True)return vehicle
#Exe
vehicle = connectUAV()
Thank you so much for any help you guys may be able to provide!