tests/md5sum.py
changeset 32870 3a64ac39b893
parent 29743 8d1cdee372e6
child 33892 904bc1dc2694
equal deleted inserted replaced
32869:cb6436e051ca 32870:3a64ac39b893
    32         sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg))
    32         sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg))
    33         sys.exit(1)
    33         sys.exit(1)
    34 
    34 
    35     m = md5()
    35     m = md5()
    36     try:
    36     try:
    37         for data in iter(lambda: fp.read(8192), ''):
    37         for data in iter(lambda: fp.read(8192), b''):
    38             m.update(data)
    38             m.update(data)
    39     except IOError as msg:
    39     except IOError as msg:
    40         sys.stderr.write('%s: I/O error: %s\n' % (filename, msg))
    40         sys.stderr.write('%s: I/O error: %s\n' % (filename, msg))
    41         sys.exit(1)
    41         sys.exit(1)
    42     sys.stdout.write('%s  %s\n' % (m.hexdigest(), filename))
    42     sys.stdout.write('%s  %s\n' % (m.hexdigest(), filename))