From dadd074ffdb2953ef463db2f8fbd467a643ce701 Mon Sep 17 00:00:00 2001 From: Andrew Gibiansky Date: Fri, 20 Mar 2015 17:00:59 -0700 Subject: [PATCH] Use stdin argument instead of input for subprocess; makes it python 3.2 compatible --- .gitignore | 1 + verify_formatting.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 6e63b9eb..f22a2a08 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ profile/profile.tar cabal.sandbox.config .tmp1 .tmp2 +.tmp3 diff --git a/verify_formatting.py b/verify_formatting.py index 20b480a5..6fb02281 100755 --- a/verify_formatting.py +++ b/verify_formatting.py @@ -8,8 +8,11 @@ import subprocess def hindent(contents): - output = subprocess.check_output(["hindent", "--style", "gibiansky"], - input=bytes(contents, 'utf-8')) + with open(".tmp3", "w") as f: + f.write(contents) + with open(".tmp3", "r") as f: + output = subprocess.check_output(["hindent", "--style", "gibiansky"], + stdin=f) return output.decode('utf-8')