From c53196b5ea5695ec4e5a77d045c969060d22d01a Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Tue, 7 Jan 2014 18:01:25 -0500 Subject: [PATCH] BUG: Make write of binary file compatible with Python 3. Open the destination file with the byte flag to avoid error in Python 3 with mismatch of str and byte. --- tests/risk/answer_key.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/risk/answer_key.py b/tests/risk/answer_key.py index 5a9615a1..8ef2fccb 100644 --- a/tests/risk/answer_key.py +++ b/tests/risk/answer_key.py @@ -109,7 +109,7 @@ def ensure_latest_answer_key(): if answer_key_dl_checksum: res = requests.get( ANSWER_KEY_DL_TEMPLATE.format(md5=answer_key_dl_checksum)) - with open(ANSWER_KEY_PATH, 'w') as f: + with open(ANSWER_KEY_PATH, 'wb') as f: f.write(res.content) # Get latest answer key on load.