diff options
Diffstat (limited to 'Lib/distutils/file_util.py')
-rw-r--r-- | Lib/distutils/file_util.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/distutils/file_util.py b/Lib/distutils/file_util.py index b3d9d54..b9f0786 100644 --- a/Lib/distutils/file_util.py +++ b/Lib/distutils/file_util.py @@ -224,6 +224,8 @@ def write_file (filename, contents): sequence of strings without line terminators) to it. """ f = open(filename, "w") - for line in contents: - f.write(line + "\n") - f.close() + try: + for line in contents: + f.write(line + "\n") + finally: + f.close() |