summaryrefslogtreecommitdiffstats
path: root/combox
diff options
context:
space:
mode:
authorSiddharth Ravikumar <sravik@bgsu.edu>2015-10-16 19:38:22 -0400
committerSiddharth Ravikumar <sravik@bgsu.edu>2015-10-16 19:38:22 -0400
commit49ea6f4a2fc4588b298329dd75c76cbc56b59562 (patch)
treee083945a01e812e8b303b7a67f859c6c247476c5 /combox
parentafe8399f3988f3fa62808f7db0575d2f2554b82e (diff)
Fxed bug #9.
Now the read_file and write_file functions in combox.file module close the file objects before returning. modified: TODO.org modified: combox/file.py
Diffstat (limited to 'combox')
-rw-r--r--combox/file.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/combox/file.py b/combox/file.py
index cb64307..b6ee97e 100644
--- a/combox/file.py
+++ b/combox/file.py
@@ -350,7 +350,10 @@ def read_file(filename):
print "ERROR: opening %s" % (filename)
exit(1)
- return file_.read()
+ content = file_.read()
+ file_.close()
+
+ return content
def hash_file(filename, file_content=None):
@@ -378,6 +381,7 @@ def write_file(filename, filecontent):
try:
file_ = open(filename, 'wb')
file_.write(filecontent)
+ file_.close()
except IOError:
print "ERROR: creating and writing content to %s" % (filename)
exit(1)