cc-4105: improved index file creation method to use 'with' statement
This commit is contained in:
parent
57a32a0da2
commit
f11d4e43ef
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue