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']):
log.info("Attempting to create index file:...")
try:
f = open(config['index_path'])
f.write(" ")
f.close()
with open(config['index_path']) as f: f.write(" ")
except Exception as e:
log.info("Failed to create index file with exception: %s" % str(e))
else: