it is best practice to have exceptions around minimal code. parse_file seems to have its out exception. It is better to have a file handler and call parse_file outside of that IOError exception handler.