Hi Andrew,
I do not know if you are still stuck with that problem. But I had the same problem and created a post with a few explanations : My S3 ImageList version
Basically, as the error message points out, the problem comes from the fact that os.scandir() expects a file system path, while S3 URIs are URLs. So you need to rewrite the get_image_files() and use AWS method to browse your hosted files. Boto3 is the python lib where you should find all the methods you need to do that.
Hope this will help.