diff options
Diffstat (limited to 'test/Move.py')
-rw-r--r-- | test/Move.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/Move.py b/test/Move.py index b58fa34..1da3aa7 100644 --- a/test/Move.py +++ b/test/Move.py @@ -37,10 +37,10 @@ Execute(Move('f1.out', 'f1.in')) Execute(Move('File-f1.out', File('f1.in-File'))) def cat(env, source, target): target = str(target[0]) - f = open(target, "wb") - for src in source: - f.write(open(str(src), "rb").read()) - f.close() + with open(target, "wb") as f: + for src in source: + with open(str(src), "rb") as ifp: + f.write(ifp.read()) Cat = Action(cat) env = Environment() env.Command('f2.out', 'f2.in', [Cat, Move("f3.out", "f3.in")]) |