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

Check if downloaded file is empty #385

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pycytominer/cyto_utils/cell_locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,14 @@ def _download_s3(self, uri: str):

self.s3.download_file(bucket, key, tmp_file.name)

return tmp_file.name
# Check if the downloaded file exists and has a size greater than 0
tmp_file_path = pathlib.Path(tmp_file.name)
if tmp_file_path.exists() and tmp_file_path.stat().st_size > 0:
return tmp_file.name
else:
raise ValueError(
f"Downloaded file '{tmp_file.name}' is empty or does not exist."
)

def _load_metadata(self):
"""Load the metadata into a Pandas DataFrame
Expand Down
Loading