Skip to content

Commit

Permalink
Patch other S3 methods with 404 detection fix
Browse files Browse the repository at this point in the history
  • Loading branch information
epwalsh committed Mar 15, 2024
1 parent 0b6e28c commit 666da70
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions olmo/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def _s3_upload(
f"s3://{bucket_name}/{key} already exists. Use save_overwrite to overwrite it."
)
except boto_exceptions.ClientError as e:
if int(e.response["Error"]["Code"]) == 404:
if e.response["ResponseMetadata"]["HTTPStatusCode"] == 404:
err = None
break
err = e
Expand All @@ -525,7 +525,7 @@ def _s3_file_size(scheme: str, bucket_name: str, key: str, max_attempts: int = 3
try:
return _get_s3_client(scheme).head_object(Bucket=bucket_name, Key=key)["ContentLength"]
except boto_exceptions.ClientError as e:
if int(e.response["Error"]["Code"]) == 404:
if e.response["ResponseMetadata"]["HTTPStatusCode"] == 404:
raise FileNotFoundError(f"s3://{bucket_name}/{key}") from e
err = e

Expand Down

0 comments on commit 666da70

Please sign in to comment.