Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3? #1

Open
jonatanskogsfors opened this issue Mar 28, 2015 · 4 comments
Open

Python 3? #1

jonatanskogsfors opened this issue Mar 28, 2015 · 4 comments

Comments

@jonatanskogsfors
Copy link
Contributor

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?

@caseymrm
Copy link
Owner

caseymrm commented Mar 30, 2015 via email

@jonatanskogsfors
Copy link
Contributor Author

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)

@caseymrm
Copy link
Owner

Hmm, interesting. I was concerned about memory usage since raw image files are so big, but it's purely theoretical currently.

@ghost
Copy link

ghost commented Feb 7, 2018

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants