Skip to content

AccessDenied (403) when downloading datasets from psb2-datasets.s3.amazonaws.com causes invalid JSON files #4

Description

@P4o1o

Hello,
I'm using psb2.fetch_examples(...) to automatically download datasets from the PSB2 suite. However, the download fails silently due to an access error from the S3 bucket:

  • The code uses requests.get(s3_url) without checking the status_code. Therefore, even when AWS responds with HTTP 403 Forbidden, the error XML (AccessDenied) is saved to a file.

  • Later, the function load_json_lines(...) attempts to parse this file, which contains XML instead of JSON, leading to a JSONDecodeError.

I've verified with curl -v: the response is indeed a 403 with the AccessDenied error from S3.

Steps to Reproduce

import psb2
train, test = psb2.fetch_examples("datasets/psb2", "bouncing-balls", 2000, 200)
# -> JSONDecodeError, because the file contains AccessDenied XML, not JSON.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions