Florian Lindner wrote in news:[EMAIL PROTECTED] in comp.lang.python:
> Hello, > I try to compute SHA hashes for different files: > > > for root, dirs, files in os.walk(sys.argv[1]): > for file in files: > path = os.path.join(root, file) > print path > f = open(path) Here you rebind 'sha' from what it was before (presumably the module sha) to the result of 'sha.new' presumably the new 'sha' doesn't have a 'new' method. try renameing your result variable. > sha = sha.new(f.read()) > sha.update(f.read()) > print sha.hexdigest() result = sha.new(f.read()) result.update(f.read()) print result.hexdigest() also I don't think you need the second call to update as f will have been read by this time and it will add nothing. > > > this generates a traceback when sha.new() is called for the second > time: > > sha = sha.new(f.read()) > AttributeError: new > Rob. -- http://www.victim-prime.dsl.pipex.com/ -- http://mail.python.org/mailman/listinfo/python-list