Skip to content

Commit

Permalink
Merge pull request #266 from seqizz/g_skipempty
Browse files Browse the repository at this point in the history
check_smartmon: Skip empty CSV files
  • Loading branch information
seqizz authored Aug 11, 2022
2 parents 9164f9a + 8fff8e4 commit 23bae09
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/check_smartmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@

for csvfile in glob.glob("*" + manufacturer + "*.csv"):
with open(csvfile) as myfile:
csv_last_line = (list(myfile)[-1])
# Get a snapshot in case file changes in the meantime
myfile_list = list(myfile)
if len(myfile_list) == 0:
# Empty, pass
continue
csv_last_line = myfile_list[-1]
csv_array = csv_last_line.split("\t")

smart_date = csv_array.pop(0).strip(";\n")
Expand Down

0 comments on commit 23bae09

Please sign in to comment.