Report meaningful error if pyserial not present in tools/readserial.py
authorKevin O'Connor <kevin@koconnor.net>
Mon, 18 Oct 2010 01:38:38 +0000 (21:38 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Mon, 18 Oct 2010 01:38:38 +0000 (21:38 -0400)
tools/readserial.py

index 505c014641f32ae0350ee35fee677cac2000bda5..9c955c6111f25badfe1b58a861f1aec3cd2ed248 100755 (executable)
@@ -111,7 +111,15 @@ def main():
 
     if options.serial:
         # Read from serial port
-        import serial
+        try:
+            import serial
+        except ImportError:
+            print """
+Unable to find pyserial package ( http://pyserial.sourceforge.net/ ).
+On Linux machines try: yum install pyserial
+Or: apt-get install python-serial
+"""
+            sys.exit(1)
         ser = serial.Serial(serialport, baud, timeout=0)
     else:
         # Read from a file