diff --git a/edosl0util/cli.py b/edosl0util/cli.py index b283aa9bc6c809b2d8b1688d8edccd578991e743..e100380a9886dbe3a415398efedef9c7856d9b3f 100644 --- a/edosl0util/cli.py +++ b/edosl0util/cli.py @@ -59,10 +59,20 @@ def cmd_info(): args = parser.parse_args() _configure_logging(args) + num_packets = 0 packets = stream.PacketStream(io.open(args.filepath, 'rb')) first = datetime(3000, 1, 1) last = datetime(1970, 1, 1) - for packet in packets: + while True: + try: + packet = packets.next() + num_packets += 1 + except stream.PacketTooShort as err: + LOG.warn("corrupt packet stream after %d packets: %s", + num_packets, err) + break + except StopIteration: + break if packet.stamp: first = min(packet.stamp, first) last = max(packet.stamp, last)