Your IOError handling looks fine to me. A better thing might be to use a with statement (http://preshing.com/20110920/the-python-with-statement-by-example/) so that no matter what happens, the file gets closed.