Remove Python 2.4-incompatible 'with' statement

This commit is contained in:
Junegunn Choi 2013-11-25 17:01:24 +09:00
parent 407d6041b3
commit 2663513b5c

View file

@ -157,7 +157,8 @@ def main():
while datetime.datetime.now() < end:
if path:
try:
with open(path) as f:
f = open(path)
try:
if search_regex:
if re.search(search_regex, f.read(), re.MULTILINE):
break
@ -165,6 +166,8 @@ def main():
time.sleep(1)
else:
break
finally:
f.close()
except IOError:
time.sleep(1)
pass