New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handle empty data_point_out.json #426
Conversation
Minimum allowed coverage is Generated by 🐒 cobertura-action against 8b4a68f |
try: | ||
with fs.open(filename, "r") as f: | ||
d = json.load(f) | ||
if not d: | ||
return None | ||
except (FileNotFoundError, json.JSONDecodeError): | ||
return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm kind of curious what kind of file would run into this block. We're already handling the file being missing and it not being valid json, which is the error hit when the file is just empty. Based on messing around a little with it, I think the file would have to be just
null
I wonder where we're creating files like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran into a case where it was just "{}" when ResStock fails in some specific step.
Pull Request Description
Sometimes, data_point_out.json can be present, but empty. This leads to obscure error downstream (see screenshot). This PR fixes the issue by treating empty json as not present.
Checklist
Not all may apply
minimum_coverage
in.github/workflows/coverage.yml
as necessary.