Skip to content

Commit

Permalink
MAINT: use with to close the file
Browse files Browse the repository at this point in the history
  • Loading branch information
François Boulogne committed Sep 22, 2015
1 parent 2063dd1 commit 1458836
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions doc/ext/plot2rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,8 @@ def write_example(src_name, src_dir, rst_dir, cfg):
ipnotebook_name = './notebook/' + ipnotebook_name
example_rst += NOTEBOOK_LINK.format(ipnotebook_name)

f = open(rst_path, 'w')
f.write(example_rst)
f.flush()
with open(rst_path, 'w') as f:
f.write(example_rst)

thumb_path = thumb_dir.pjoin(src_name[:-3] + '.png')
first_image_file = image_dir.pjoin(figure_list[0].lstrip('/'))
Expand Down

0 comments on commit 1458836

Please sign in to comment.