Skip to content

fs.open returns ResourceNotFound (404) even though fs.exists finds the path #70

Open
@poudro

Description

@poudro

Been having a strange issue with fs.open on various files.

The code is basically

    if not fs.exists(path_in_fs):
        return None

    try:
        with fs.open(path_in_fs, 'rb') as f:
            <- read file
    except Exception as err:
        raise err

Sometimes fs.exists will say that a file exists in s3 but the fs.open step will return a ResourceNotFound error.

I tracked the error in fs.open to this section of the code https://github.com/PyFilesystem/s3fs/blob/master/fs_s3fs/_s3fs.py#L433-L441, but I'm a bit at a loss as to why an exception should be triggered here but not for the fs.exists.

Finally, if I delete the file via other means (awscli or in s3 browser), and recreate the file (by copying a local copy to s3 via awscli), it will then work without triggering an error.

Any help on what I'm doing wrong would be greatly appreciated.

Because of this last element it's a bit hard to reproduce, but if you need more details please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions