Unverified Commit 11d123b5 authored by Maxim Belkin's avatar Maxim Belkin
Browse files

fig/optimize_svg.py: use context manager

... to guarantee that files are closed when we're done working with scour
parent fd11aa31
......@@ -132,9 +132,8 @@ def optimize_with_scour(files):
# .start will close the files. Weird flex but ok
infile = open(options.infilename, 'rb')
outfile = open(options.outfilename, 'wb')
scour.start(options, infile, outfile)
with open(file, 'rb') as infile, open(options.outfilename, 'wb') as outfile:
scour.start(options, infile, outfile)
except FileNotFoundError:
# Doing this because we have a list of
# hard-coded file names
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment