From: SourceForge.net <no...@so...> - 2011-05-13 15:15:39
|
Bugs item #2715388, was opened at 2009-03-26 16:38 Message generated for change (Comment added) made by wtpollard You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=887015&aid=2715388&group_id=178907 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: s3cmd Group: None Status: Open Resolution: Works For Me Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Michal Ludvig (ludvigm) Summary: s3cmd-0.9.9 with python 2.4.4 not working Initial Comment: Hello! I get the following error. I fixed it by adding "import sha" and changing "return base64.encodestring(hmac.new(self.config.secret_key, h, sha1).digest()).strip()" to "return base64.encodestring(hmac.new(self.config.secret_key, h, sha).digest()).strip()" in S3/S3.py !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! An unexpected error has occurred. Please report the following lines to: s3t...@li... !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Problem: AttributeErr: 'builtin_function_or_method' object has no attribute 'new' S3cmd: 0.9.9 Python: 2.4.4 (#2, Oct 22 2008, 19:52:44) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] Traceback (most recent call last): File "/usr/bin/s3cmd", line 1562, in ? main() File "/usr/bin/s3cmd", line 1542, in main cmd_func(args) File "/usr/bin/s3cmd", line 95, in cmd_buckets_list_all_all response = s3.list_all_buckets() File "/usr/lib/python2.4/site-packages/S3/S3.py", line 108, in list_all_buckets request = self.create_request("LIST_ALL_BUCKETS") File "/usr/lib/python2.4/site-packages/S3/S3.py", line 340, in create_request signature = self.sign_headers(method_string, resource, headers) File "/usr/lib/python2.4/site-packages/S3/S3.py", line 652, in sign_headers return base64.encodestring(hmac.new(self.config.secret_key, h, sha1).digest()).strip() File "hmac.py", line 107, in new return HMAC(key, msg, digestmod) File "hmac.py", line 42, in __init__ self.outer = digestmod.new() AttributeError: 'builtin_function_or_method' object has no attribute 'new' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! An unexpected error has occurred. Please report the above lines to: s3t...@li... !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ---------------------------------------------------------------------- Comment By: Tom Pollard (wtpollard) Date: 2011-05-13 11:15 Message: I'm having exactly the same problem when I try to run s3cmd on a CentOS 5.5 image with python 2.4.3. I did the following experiment, Python 2.4.3 (#1, Nov 11 2010, 13:34:43) [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from hashlib import md5, sha1 >>> import sha >>> md5.new() Traceback (most recent call last): File "<stdin>", line 1, in ? AttributeError: 'builtin_function_or_method' object has no attribute 'new' >>> sha1.new() Traceback (most recent call last): File "<stdin>", line 1, in ? AttributeError: 'builtin_function_or_method' object has no attribute 'new' >>> sha.new() <sha.SHA object at 0xb7f55640> >>> The import from hashlib isn't failing, but the version of md5 and sha1 that are imported don't have the new() method that s3cmd require. Adding 'import sha' and replacing the reference to sha1 with sha in S3/Utils.py works around the problem in my hands, too. ---------------------------------------------------------------------- Comment By: https://www.google.com/accounts () Date: 2010-03-03 01:21 Message: I had the same issue, it has to do with the sha1 library. I am not a python developer but I figured a work around, it is like this: 1) vi /usr/lib/python2.4/site-packages/S3/Utils.py 2) add: import sha 3) go to line 290 and replace this: signature = base64.encodestring(hmac.new(Config.Config().secret_key, string_to_sign, sha1).digest()).strip() with this: signature = base64.encodestring(hmac.new(Config.Config().secret_key, string_to_sign, digestmod=sha).digest()).strip() 4) Save and try again I got the idea from here: http://code.google.com/p/boto/issues/detail?id=172 ---------------------------------------------------------------------- Comment By: Michal Ludvig (ludvigm) Date: 2009-03-26 20:39 Message: You must be having some funny version of python I guess. The 'sha' module in Python 2.4 should be imported with: import sha as sha1 so referencing to it later as to 'sha1' is all right. I can't reproduce it on my Python 2.4.3 installation. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=887015&aid=2715388&group_id=178907 |