From 60c896dff223f7dcb12eae5ffa23a3281dd66952 Mon Sep 17 00:00:00 2001 From: kienle <kienle@passcal.nmt.edu> Date: Wed, 27 Sep 2023 17:02:45 -0600 Subject: [PATCH] Fix bug with some log files Fix problem with log files that have more than one blank lines at the end. --- .../model/reftek_data/reftek_reader/log_file_reader.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sohstationviewer/model/reftek_data/reftek_reader/log_file_reader.py b/sohstationviewer/model/reftek_data/reftek_reader/log_file_reader.py index 8ff7d02c2..5da9ae02c 100644 --- a/sohstationviewer/model/reftek_data/reftek_reader/log_file_reader.py +++ b/sohstationviewer/model/reftek_data/reftek_reader/log_file_reader.py @@ -122,6 +122,12 @@ class LogFile: line = self.file.readline() if line == '': break + # If there are more than one blank lines at the end of a log file, the + # last packet will be empty. This causes problem if the log file came + # from rt2ms or SOHStationViewer. + if not packet: + self.file.close() + raise StopIteration return packet def __del__(self): -- GitLab