This issue can be closed when data_parser.py (rather, functions therein) check for a log file from Temoa before attempting to parse any data.
Current behavior: attempts to parse data, even if no log files exist.
Desired behavior: only parse data IF log files exist.
Guidance:
This can be accomplished with either an assert statement
e.g.
assert(filename is not None), "No log file found"
This will throw an AssertionError.
Or with a Try/Except block
e.g.
def get_output_files():
"""
This function returns a list of paths to the Temoa output files.
Returns:
--------
path_list : list of strings
The list of paths to output files.
"""
path = "./data_files/**/*.log"
try:
path_list = glob.glob(path, recursive=True)
except FileNotFoundError:
print("No log files found")
return path_list
I think the first solution might be better because glob will succeed, even if it returns an empty list.
This issue can be closed when
data_parser.py
(rather, functions therein) check for a log file from Temoa before attempting to parse any data.Current behavior: attempts to parse data, even if no log files exist. Desired behavior: only parse data IF log files exist.
Guidance: This can be accomplished with either an
assert
statement e.g.This will throw an
AssertionError
.Or with a
Try/Except
blocke.g.
I think the first solution might be better because
glob
will succeed, even if it returns an empty list.