cc-4105: improved index file creation method to use 'with' statement

This commit is contained in:
Rudi Grinberg 2012-08-14 17:12:15 -04:00
parent 57a32a0da2
commit f11d4e43ef
1 changed files with 1 additions and 3 deletions

View File

@ -57,9 +57,7 @@ def main(global_config, api_client_config, log_config,
if not os.path.exists(config['index_path']): if not os.path.exists(config['index_path']):
log.info("Attempting to create index file:...") log.info("Attempting to create index file:...")
try: try:
f = open(config['index_path']) with open(config['index_path']) as f: f.write(" ")
f.write(" ")
f.close()
except Exception as e: except Exception as e:
log.info("Failed to create index file with exception: %s" % str(e)) log.info("Failed to create index file with exception: %s" % str(e))
else: else: