diff --git a/osc_tui/main.py b/osc_tui/main.py index c1e6c24..2594cb0 100644 --- a/osc_tui/main.py +++ b/osc_tui/main.py @@ -142,11 +142,11 @@ def main(): i += 1 if i == argc: if os.path.isfile(profileSelector.dst_file): - configFile = open(profileSelector.dst_file) - OAPI_CREDENTIALS = json.loads(configFile.read()) - print("Profiles:") - for c in OAPI_CREDENTIALS: - print(str(c)) + with open(profileSelector.dst_file, 'r') as configFile: + OAPI_CREDENTIALS = json.loads(configFile.read()) + print("Profiles:") + for c in OAPI_CREDENTIALS: + print(str(c)) else: print("{} not found, can't read profile !!!". format(profileSelector.dst_file),