From: Dibya Prakash Das Date: Tue, 15 May 2018 10:06:02 +0000 (+0000) Subject: Fix open files X-Git-Tag: pre-potassium~790 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=30c0e76e3b0b8312cd0c97d422f7cf4ff17f4275;p=integration%2Ftest.git Fix open files Change-Id: I6ae9a167c6c7f1cabf52871f22c18ef48c10aa78 Signed-off-by: Dibya Prakash Das --- diff --git a/csit/scripts/push_to_elk.py b/csit/scripts/push_to_elk.py index 41f4a0b7c6..1f6f258ced 100755 --- a/csit/scripts/push_to_elk.py +++ b/csit/scripts/push_to_elk.py @@ -95,7 +95,8 @@ else: for f in csv_files: key = (f.split('/')[-1])[:-4] BODY['plots'][key] = {} - lines = open(f).readlines() + with open(f) as file: + lines = file.readlines() props = lines[0].strip().split(',') vals = lines[1].strip().split(',') BODY['plots'][key][props[0]] = float(vals[0])