Skip to content
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

fix: UpRoot's KeyInFileError Handling for Preprocessor's File Exception Parameter; Fixes #1107 #1106

Merged
merged 2 commits into from
Jun 13, 2024

Conversation

SamKelson
Copy link
Contributor

Hi all,

I noticed that when using the preprocessor's file_exception parameter, uproot's KeyInFileError was not always caught. This happens because the TTree is being accessed outside of the try-except statement where the file_exception parameter is being used. So while the file may be opened correctly, the try-except statement does not capture errors regarding the reading of TTrees within the file.

I am unsure if this is the desired behavior or not. I have implemented a fix for the bug below and added a test to make sure this bug cannot creep up again.

Allowing the preprocessor to skip over files that give user-specified exceptions can save the user a lot of headaches, especially if the user wants to ignore a small number of bad files in an otherwise large batch of working files. However, it may be worth giving some type of warning to the user in the future.

@SamKelson SamKelson marked this pull request as ready for review June 12, 2024 20:47
@SamKelson SamKelson marked this pull request as draft June 12, 2024 22:26
@SamKelson SamKelson changed the title Fix UpRoot's KeyInFileError Handling for Preprocessor's File Exception Parameter Fix UpRoot's KeyInFileError Handling for Preprocessor's File Exception Parameter; Fixes #1107 Jun 12, 2024
@SamKelson SamKelson marked this pull request as ready for review June 12, 2024 22:33
@SamKelson
Copy link
Contributor Author

Fixes #1107

@lgray lgray merged commit 31bec5c into CoffeaTeam:master Jun 13, 2024
13 of 14 checks passed
@lgray lgray changed the title Fix UpRoot's KeyInFileError Handling for Preprocessor's File Exception Parameter; Fixes #1107 fix: UpRoot's KeyInFileError Handling for Preprocessor's File Exception Parameter; Fixes #1107 Jun 13, 2024
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