From 859c5e28df90851838aacc4b9ad49d3630e4992a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 30 Aug 2016 02:52:12 -0400 Subject: Use context manager in scripts. --- ghwt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ghwt.py') diff --git a/ghwt.py b/ghwt.py index 493b1e2..bb0be70 100755 --- a/ghwt.py +++ b/ghwt.py @@ -52,8 +52,8 @@ def unpack(sproj, branch, outdir): return 1 spdir = os.path.split(outdir)[0] ofilename = os.path.join(spdir, config['wrap-file']['source_filename']) - ofile = open(ofilename, 'wb') - ofile.write(us) + with open(ofilename, 'wb') as ofile: + ofile.write(us) if 'lead_directory_missing' in config['wrap-file']: os.mkdir(outdir) shutil.unpack_archive(ofilename, outdir) -- cgit v1.1