From 33978b391066ad13d72d2e52dc8b81cec187b40a 2012-08-21 18:18:44 From: Takafumi Arakaki Date: 2012-08-21 18:18:44 Subject: [PATCH] Python 3 compatibility fix on tests/writetofile.py --- diff --git a/IPython/frontend/terminal/console/tests/writetofile.py b/IPython/frontend/terminal/console/tests/writetofile.py index 30f7332..5cc879d 100644 --- a/IPython/frontend/terminal/console/tests/writetofile.py +++ b/IPython/frontend/terminal/console/tests/writetofile.py @@ -10,11 +10,15 @@ Copy data from input file to output file for testing. """ import sys +from IPython.utils.py3compat import PY3 (inpath, outpath) = sys.argv[1:] if inpath == '-': - infile = sys.stdin + if PY3: + infile = sys.stdin.buffer + else: + infile = sys.stdin else: - infile = open(inpath) + infile = open(inpath, 'rb') open(outpath, 'w+b').write(infile.read())