Skip to content

Fix h5pyf not found when flushing HDF5 output processor#3

Open
arryon wants to merge 2 commits into
masterfrom
bugfix/fileoutput-h5pyf-not-found
Open

Fix h5pyf not found when flushing HDF5 output processor#3
arryon wants to merge 2 commits into
masterfrom
bugfix/fileoutput-h5pyf-not-found

Conversation

@arryon

@arryon arryon commented Sep 29, 2017

Copy link
Copy Markdown
Member

In case finalize is called on the file output processor, sometimes self.h5pyf is not found. In this case, using hasattr prevents Python throwing an error. For convenience, I've created a class method that can be called to flush and close the file handle

@arryon arryon requested a review from RonaldAJ September 29, 2017 12:20

@RonaldAJ RonaldAJ left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if self.h5pyf is None? I think this is still a possible value.

In addition I found:https://hynek.me/articles/hasattr/ showing other potential risks.

@arryon

arryon commented Sep 29, 2017

Copy link
Copy Markdown
Member Author

Good point, thanks for the resource. I will update the PR accordingly

@arryon

arryon commented Nov 7, 2017

Copy link
Copy Markdown
Member Author

I've updated the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants