PyFilesystem / pyfilesystem

Python filesystem abstraction layer
http://pyfilesystem.org/
BSD 3-Clause "New" or "Revised" License
287 stars 63 forks source link

Support S3 with Python3 #232

Open KyleJamesWalker opened 8 years ago

KyleJamesWalker commented 8 years ago

Boto now supports python3, but this module doesn't when trying to access an s3 bucket with the following code:

from fs.opener import fsopendir
fsopendir('s3://my_bucket').listdir()
env/lib/python3.5/site-packages/fs-0.5.5a1-py3.5.egg/fs/s3fs.py in _s3path(self, path)
    177         path = relpath(normpath(path))
    178         path = self._separator.join(iteratepath(path))
--> 179         s3path = self._prefix + path
    180         if s3path and s3path[-1] == self._separator:
    181             s3path = s3path[:-1]

TypeError: can't concat bytes to str

Code now lists the files in the bucket just fine, I can only run unit tests on python 2.7.x (which pass with this change), I'm not able to run the tests on python 3 so I can't verify all cases when working with s3 files will work without making major modifications to the codebase.