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:
Julian Oes
2020-01-16 16:25:26 +01:00
parent e98fa891fe
commit b04f68553e
7 changed files with 63 additions and 36 deletions
+18 -7
View File
@@ -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():