File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 11import sys
22import csv
33import signal
4- import serial
54import select
65import struct
76import tinylink
87import argparse
98import cStringIO
109import time
1110
11+ try :
12+ import serial
13+ except ImportError :
14+ serial = None
15+
1216def run ():
1317 """
1418 Entry point for console script.
1519 """
20+
1621 sys .exit (main ())
1722
1823def parse_arguments ():
@@ -159,14 +164,20 @@ def main():
159164 Main entry point.
160165 """
161166
167+ if serial is None :
168+ sys .stdout .write ("TinyLink CLI uses PySerial, but it is not " \
169+ "installed. Please install this first\n " )
170+ return 1
171+
172+ # Parse arguments
162173 arguments , parser = parse_arguments ()
163174
164- # Open serial port and create link
165175 if arguments .endianness == "little" :
166176 endianness = tinylink .LITTLE_ENDIAN
167177 else :
168178 endianness = tinylink .BIG_ENDIAN
169179
180+ # Open serial port and create link
170181 handle = serial .Serial (arguments .port , baudrate = arguments .baudrate )
171182 link = tinylink .TinyLink (handle , max_length = arguments .length ,
172183 endianness = endianness )
Original file line number Diff line number Diff line change 33
44def crc32 (buf ):
55 """
6- Calculate CRC32 of given input
6+ Calculate CRC32 of given input.
77 """
88
99 result = CRC32_INITIAL
You can’t perform that action at this time.
0 commit comments