From 575c608688d0e49702afc7c9f9be8a95a5ff2a40 Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Fri, 3 Sep 2021 17:03:29 +0200 Subject: [PATCH] Tools: allow to use sim_vehicle.py without pymavlink installed --- Tools/autotest/sim_vehicle.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Tools/autotest/sim_vehicle.py b/Tools/autotest/sim_vehicle.py index 39301b0319..9c5e7fa546 100755 --- a/Tools/autotest/sim_vehicle.py +++ b/Tools/autotest/sim_vehicle.py @@ -28,7 +28,6 @@ import shlex import binascii import math -from pymavlink import mavextra from pysim import vehicleinfo @@ -38,6 +37,12 @@ windowID = [] autotest_dir = os.path.dirname(os.path.realpath(__file__)) root_dir = os.path.realpath(os.path.join(autotest_dir, '../..')) +try: + from pymavlink import mavextra +except ImportError: + sys.path.append(os.path.join(root_dir, "modules/mavlink")) + from pymavlink import mavextra + os.environ["SIM_VEHICLE_SESSION"] = binascii.hexlify(os.urandom(8)).decode()