Question regarding checksuming of a file

Andrew Robert andrew.arobert at gmail.com
Sun May 14 14:51:05 EDT 2006


When I run the script, I get an error that the file object does not have
 the attribute getblocks.

 Did you mean this instead?

 def getblocks(f, blocksize=1024):
 	while True:
 		s = f.read(blocksize)
 		if not s: return
 		yield s

 def getsum(self):
 	md5sum = md5.new()
         f = open(self.file_name, 'rb')
         for line in getblocks(f) :
             md5sum.update(line)
         f.close()
 	return md5sum.hexdigest()




More information about the Python-list mailing list