From 352113d195784413e28c77ffcc414fabde6faa30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albrecht=20M=C3=BChlenschulte?= Date: Tue, 2 Jul 2019 17:07:43 +0200 Subject: [PATCH] trying to fix python-version issue --- pre_commit_hooks/detect_aws_credentials.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pre_commit_hooks/detect_aws_credentials.py b/pre_commit_hooks/detect_aws_credentials.py index 328116b..e965c21 100644 --- a/pre_commit_hooks/detect_aws_credentials.py +++ b/pre_commit_hooks/detect_aws_credentials.py @@ -76,8 +76,9 @@ def check_file_for_aws_keys(filenames, keys): bad_files = [] for filename in filenames: - with open(filename, 'r', errors='ignore') as content: - text_body = content.read() + with io.open(filename, 'rb') as content: + binary_body = content.read() + text_body = binary_body.decode(error='ignore') for key in keys: # naively match the entire file, low chance of incorrect # collision