diff options
author | Laurent Bachelier <laurent@bachelier.name> | 2020-01-19 19:03:00 +0100 |
---|---|---|
committer | Laurent Bachelier <laurent@bachelier.name> | 2020-01-19 19:04:33 +0100 |
commit | 54a836119698a1379ec6c25c0de97cd6afe98682 (patch) | |
tree | 6053aad1ebfb2e1423cbffe8f97c0ab294a6d3f3 /rencon | |
parent | License as MIT (diff) | |
download | rencon-master.tar.xz |
Diffstat (limited to 'rencon')
-rwxr-xr-x | rencon | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import absolute_import, print_function, unicode_literals import argparse @@ -22,7 +22,7 @@ def rename(fpath, mask, algorithm, abbrev=None, out=sys.stdout, err=sys.stderr): if not os.path.exists(fpath): print("File %s does not exists." % fpath, file=err) else: - with open(fpath) as fp: + with open(fpath, 'rb') as fp: hasher = getattr(hashlib, algorithm) hsh = hashfile(hasher, fp).hexdigest() if abbrev: @@ -60,7 +60,7 @@ if __name__ == '__main__': parser.add_argument('-p', '--pretend', action='store_true', help="do not rename, just print") parser.add_argument('-a', '--algorithm', - help="hash algorithm", choices=hashlib.algorithms, default='sha1') + help="hash algorithm", choices=hashlib.algorithms_available, default='sha1') parser.add_argument('-b', '--abbrev', metavar='N', type=abbrev, help="use the first N digits", default=None) |