combox

split and encrypted files between online file storage providers
git clone git://git.ricketyspace.net/combox.git
Log | Files | Refs

commit 49ea6f4a2fc4588b298329dd75c76cbc56b59562
parent afe8399f3988f3fa62808f7db0575d2f2554b82e
Author: Siddharth Ravikumar <sravik@bgsu.edu>
Date:   Fri, 16 Oct 2015 19:38:22 -0400

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:
TODO.org | 5++++-
combox/file.py | 6+++++-
2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/TODO.org b/TODO.org @@ -44,7 +44,10 @@ CLOSED: [2015-09-12 Sat 23:29] - CLOSING NOTE [2015-09-12 Sat 23:29] \\ Fixed. -**** TODO read_file and write_file functions in combox.file must call close() on file objects :b#9: +**** DONE read_file and write_file functions in combox.file must call close() on file objects :b#9: + CLOSED: [2015-10-16 Fri 19:37] + - CLOSING NOTE [2015-10-16 Fri 19:37] \\ + Fixed it. ** functionlity *** DONE rewrite combox.events.NodeDirMonitor.on_created method CLOSED: [2015-04-01 Wed 23:06] diff --git 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)