mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 15:58:53 +08:00
Tools: use Python 3, improve import checks
In more detail: - Change shebang to Python 3. - Suggest installation using pip3 as user.
This commit is contained in:
+18
-7
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
"""
|
||||
Open a shell over MAVLink.
|
||||
@@ -11,16 +11,27 @@ from __future__ import print_function
|
||||
import sys, select
|
||||
import termios
|
||||
from timeit import default_timer as timer
|
||||
from argparse import ArgumentParser
|
||||
|
||||
try:
|
||||
from pymavlink import mavutil
|
||||
import serial
|
||||
except:
|
||||
print("Failed to import pymavlink.")
|
||||
print("You may need to install it with 'pip install pymavlink pyserial'")
|
||||
except ImportError as e:
|
||||
print("Failed to import pymavlink: " + e)
|
||||
print("")
|
||||
raise
|
||||
from argparse import ArgumentParser
|
||||
print("You may need to install it with:")
|
||||
print(" pip3 install --user pymavlink")
|
||||
print("")
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
import serial
|
||||
except ImportError as e:
|
||||
print("Failed to import pyserial: " + e)
|
||||
print("")
|
||||
print("You may need to install it with:")
|
||||
print(" pip3 install --user pyserial")
|
||||
print("")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
class MavlinkSerialPort():
|
||||
|
||||
Reference in New Issue
Block a user