-
Notifications
You must be signed in to change notification settings - Fork 201
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
image-checker.py fails under Python 3 #104
Comments
@edgemaster thanks for reporting! Is this something you'd feel comfortable fixing yourself or do you need an assist or have any questions? |
I'm happy to raise a PR to fix it. (Tbh, a rewrite into JS would be nicer, but I don't have the time for that(!)) |
That would be awesome! Thanks @edgemaster . Yeah a JS rewrite might be helpful long run, but considering how this library most likely isn't a major production dependency for everyone...let's do it the lazy way :) |
Hello, I wrote image-checker.py using Python 2.7, so I'm not entirely surprised, but sorry about that! Python 3 support would be good, and probably not too difficult. It'd be a good idea to enable Travis CI for your repo, and add Python 3 (e.g. 3.6): https://github.com/hugovk/emojipacks/blob/master/.travis.yml#L3 Some options:
It would be a good idea to at least report the problem to wget even though it's not very active: |
Move from using wget library to direct calls to urllib, doesn't add too much additional complexity to the code. Also handle HTTP errors as script errors instead of terminating abnormally. Fixes lambtron#104
I've opted to remove the dependency on wget and use urllib2 directly to download the images. It also removes the need to write out to a temporary file, as everything can be done in memory. It also simplifies the handling of http errors that wget would throw. I don't think it provides less functionality, but I could have missed something. |
Move from using wget library to direct calls to urllib, doesn't add too much additional complexity to the code. Also handle HTTP errors as script errors instead of terminating abnormally. Fixes #104
Stack trace:
It looks like the monkey patch line to set the UserAgent for the wget library isn't taking effect for Python 3, this is probably because that library uses different urllib implementations on different Python versions.
Ran into this whilst trying to update the test suite for #52.
The text was updated successfully, but these errors were encountered: