Hi Tim,
thanks for the patch. However it is a workaround for a pretty unusual
configuration and I don't think I will apply it as it is. I may perhaps
reimplement it with checking for the functionality instead of Python
version. Will see.
But thanks for the report anyway!
Michal
On 04/23/2010 09:15 PM, Timothee Linden wrote:
> Hi again,
>
> A friend of mine (waaaaay more skilled than me at Python) found the
> issue. The system where this problem was occuring had a manually
> istalled hashlib for python 2.4, and it seems that doesn't work well
> with hmac.py :/ .
>
> Below is the diff he he made on the file S3/Utils.py:
>
> ============================================
> $ diff ../tmp/s3cmd-0.9.9.91/S3/Utils.py S3/Utils.py
> 5a6,7
>> import sys
>> import distutils.version as version
> 13c15,18
> < from hashlib import md5, sha1
> ---
>> if version.LooseVersion(sys.version) >= version.LooseVersion('2.5'):
>> from hashlib import md5, sha1
>> else:
>> raise ImportError
> ============================================
>
> That solved it for me with Python 2.4 :)
>
> Cheers!
> Tim.
>
>
>
>
> On Fri, Apr 23, 2010 at 3:25 PM, Timothee Linden <[email protected]
> <mailto:[email protected]>> wrote:
>
> Hi there,
>
> I'm a new user of s3cmd and I love it! Many thanks for making this
> nifty little utility.
>
> I've been using s3cmd in various environments and one of them had
> python 2.4.4 by default:
> Python 2.4.4 (#2, Jan 24 2010, 11:50:13)
> [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)]
>
> when running s3cmd, I hit the following error:
> ======================================================
> $ s3cmd ls
>
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> An unexpected error has occurred.
> Please report the following lines to:
> [email protected]
> <mailto:[email protected]>
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>
> Problem: AttributeErr: 'builtin_function_or_method' object has no
> attribute 'new'
> S3cmd: 0.9.9.91
>
> Traceback (most recent call last):
> File "/home/timothee/bin/s3cmd", line 1736, in ?
> main()
> File "/home/timothee/bin/s3cmd", line 1681, in main
> cmd_func(args)
> File "/home/timothee/bin/s3cmd", line 91, in cmd_ls
> subcmd_buckets_list_all(s3)
> File "/home/timothee/bin/s3cmd", line 104, in subcmd_buckets_list_all
> response = s3.list_all_buckets()
> File "/home/timothee/bin/S3/S3.py", line 159, in list_all_buckets
> request = self.create_request("LIST_ALL_BUCKETS")
> File "/home/timothee/bin/S3/S3.py", line 396, in create_request
> request = S3Request(self, method_string, resource, headers, params)
> File "/home/timothee/bin/S3/S3.py", line 36, in __init__
> self.sign()
> File "/home/timothee/bin/S3/S3.py", line 70, in sign
> signature = sign_string(h)
> File "/home/timothee/bin/S3/Utils.py", line 290, in sign_string
> signature =
> base64.encodestring(hmac.new(Config.Config().secret_key,
> string_to_sign, 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:
> [email protected]
> <mailto:[email protected]>
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> ======================================================
>
> Something wrong with the hmac library.
>
> The environment I was in also had python2.5 installed and by
> changing the first line from:
> #!/usr/bin/env python
> to
> #!/usr/bin/python2.5
> It worked again.
>
> However, given that s3cmd lists:
> ======================================================
> if float("%d.%d" %(sys.version_info[0], sys.version_info[1])) < 2.4:
> sys.stderr.write("ERROR: Python 2.4 or higher required,
> sorry.\n")
> sys.exit(1)
> ======================================================
> I was expecting it to work in 2.4.4 as well.
>
>
> That's it, let me know if you need more information on my system;
> and many thanks again for this wonderful tool!
>
> Tim.
>
>
>
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> S3tools-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/s3tools-general
------------------------------------------------------------------------------
_______________________________________________
S3tools-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/s3tools-general