-
-
Notifications
You must be signed in to change notification settings - Fork 70
Add Shared function to open data files #254
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
base: main
Are you sure you want to change the base?
Conversation
|
@Joyakis This PR includes unrelated files related to wikicommons |
d1ed38d to
1a13e79
Compare
Hello...I have removed the files |
scripts/shared.py
Outdated
| return session | ||
|
|
||
|
|
||
| def open_data_file(logger, file_path, usecols=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.
Please add index_col=None and update scripts appropriately.
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.
Okay..done
scripts/shared.py
Outdated
|
|
||
| # File does not exist | ||
| except FileNotFoundError: | ||
| raise QuantifyingException( | ||
| message=f"Data file not found: {file_path}", exit_code=1 | ||
| ) | ||
|
|
||
| # Empty or invalid CSV file | ||
| except pd.errors.EmptyDataError: | ||
| raise QuantifyingException( | ||
| message=f"CSV file is empty or invalid: {file_path}", exit_code=1 | ||
| ) | ||
|
|
||
| # Permission denied | ||
| except PermissionError: | ||
| raise QuantifyingException( | ||
| message=f"Permission denied when accessing data file: {file_path}", | ||
| exit_code=1, | ||
| ) | ||
|
|
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.
Please remove the blank lines between exceptions
Fixes
Description
This pull request adds enhanced error handling in the shared file for opening data files in the reporting and processing scripts
Checklist
Update index.md).mainormaster).visible errors.
Developer Certificate of Origin
For the purposes of this DCO, "license" is equivalent to "license or public domain dedication," and "open source license" is equivalent to "open content license or public domain dedication."
Developer Certificate of Origin