Skip to content

Instantly share code, notes, and snippets.

@dlemphers
Created December 7, 2011 23:21
Show Gist options
  • Save dlemphers/1445251 to your computer and use it in GitHub Desktop.
Save dlemphers/1445251 to your computer and use it in GitHub Desktop.
Simple Python Config Read try/except block for IOError
try:
self.config.readfp(open(config_file_path))
except IOError as (errno, strerror):
logging.warning('I/O error({0}): {1}'.format(errno, strerror))
logging.warning('Please check that {0} exists'.format(config_file_path))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment