| 1 |
#----------------------------------------------------------------------------- |
| 2 |
# Copyright (C) 2012 The IPython Development Team |
| 3 |
# |
| 4 |
# Distributed under the terms of the BSD License. The full license is in |
| 5 |
# the file LICENSE, distributed as part of this software. |
| 6 |
#----------------------------------------------------------------------------- |
| 7 |
|
| 8 |
""" |
| 9 |
Copy data from input file to output file for testing. |
| 10 |
|
| 11 |
Command line usage: |
| 12 |
|
| 13 |
python writetofile.py INPUT OUTPUT |
| 14 |
|
| 15 |
Binary data from INPUT file is copied to OUTPUT file. |
| 16 |
If INPUT is '-', stdin is used. |
| 17 |
|
| 18 |
""" |
| 19 |
|
| 20 |
if __name__ == '__main__': |
| 21 |
import sys |
| 22 |
(inpath, outpath) = sys.argv[1:] |
| 23 |
|
| 24 |
if inpath == '-': |
| 25 |
infile = sys.stdin.buffer |
| 26 |
else: |
| 27 |
infile = open(inpath, 'rb') |
| 28 |
|
| 29 |
open(outpath, 'w+b').write(infile.read()) |