Add try except around file IO to catch any IOErrors.
Adding more documentation and putting it into restructured text.