Boto is a Python library for interacting with Amazon’s web services. I’ve used it in the past, and am currently using it for an ‘s3get’ implementation based on a simple example I found buried in a post on Patrick Altman’s blog.
While testing my code, I noticed I was getting import errors from boto/connection.py, because I didn’t have a module on my system named ‘hashlib’. Then I found an svn trunk commit that clued me in to the fact that I wasn’t supposed to have hashlib, because I was running a pre-2.5 version of Python. They had put in a fix for pre-2.5 users, but somehow it wasn’t being obeyed.
Then I noticed that the import errors weren’t from utils.py, where the fix was committed, but from connection.py, which was explicitly importing the module itself. Closer inspection revealed that it was also importing utils.py, which itself imports hashlib. I commented out the explicit import in connection.py (and, later, in boto/s3/key.py), and stopped getting import errors.
If you’re still having issues with Patrick’s s3get.py code, it’s probably because you need to change this line:
if name == 'main': main()
To this:
if __name__ == '__main__': main()