Skip to content

Verify existence of log file #143

Description

@samgdotson

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.

Metadata

Metadata

Assignees

Labels

Comp:BuildThis issue has to do with the build system of the code/doc (makefiles, cmake, install errors)Difficulty:1-BeginnerThis issue does not require expert knowledge and may be a good issue for new contributors.Priority:2-NormalThis work is important and should be completed ASAP.Status:1-NewNo one has claimed this issue yet. It is in need of solving.Type:BugSomething is wrong or broken. This issue or PR is related to a bug in code.Type:TestIs related to software testing. Failing tests, necessary new tests, test frameworks, etc.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions