Python 3?
Opened this issue · 4 comments
Hi! I started looking at drivesink today to backup my photos. Would you be open to pull requests that ports drivesink to Python3 or do you like it to remain in Python 2?
I have tested with simple 2to3 conversion and it seems to work with only small alterations. Unfortunately I started to get the error mentioned in #4 (requests.exceptions.HTTPError: 500 Server Error: Internal Server Error
) so high level testing came to a halt.
When I was looking in to this problem today I noticed something else. The _md5sum
function gets stuck in the item loop when using python 3. It seems to work when I remove the blocksize from read (see below). Is there a reason why are you reading so few bytes at a time?
def _md5sum(self, filename, blocksize=65536):
md5 = hashlib.md5()
with open(filename, "r+b") as f:
md5.update(f.read())
return md5.hexdigest()
(Line 74 in drivesink.py)
Hmm, interesting. I was concerned about memory usage since raw image files are so big, but it's purely theoretical currently.
Hi, I made this work with chunked reading like this:
for block in iter(lambda: f.read(blocksize), b''):
See #26.
I assume, this issue can be closed then?