Replace file() with open() for Python 3 compatibility

The built-in named 'file' has been removed since Python 3.0 [1]
This patch replaces it by 'open' which is the same under Python 2 and 3.

[1] https://docs.python.org/release/3.0/whatsnew/3.0.html#builtins

Change-Id: Ib2abbd0f6aea4423acae0c7dceccf1ef67c1caae
This commit is contained in:
Vu Cong Tuan 2018-07-05 10:35:31 +07:00
parent 7201fdce87
commit 7be92d78fc
1 changed files with 4 additions and 4 deletions

View File

@ -105,7 +105,7 @@ EVENT_TYPES_FILE = get_events_yaml_filename()
if not os.path.isfile(EVENT_TYPES_FILE):
exit (-1)
stream = file(EVENT_TYPES_FILE, 'r')
with open(EVENT_TYPES_FILE, 'r') as stream:
event_types = yaml.load(stream)
for alarm_id in event_types: