Commit 9c798b11 by Junegunn Choi

Remove Python 2.4-incompatible 'with' statement

parent 828b9f87
...@@ -157,7 +157,8 @@ def main(): ...@@ -157,7 +157,8 @@ def main():
while datetime.datetime.now() < end: while datetime.datetime.now() < end:
if path: if path:
try: try:
with open(path) as f: f = open(path)
try:
if search_regex: if search_regex:
if re.search(search_regex, f.read(), re.MULTILINE): if re.search(search_regex, f.read(), re.MULTILINE):
break break
...@@ -165,6 +166,8 @@ def main(): ...@@ -165,6 +166,8 @@ def main():
time.sleep(1) time.sleep(1)
else: else:
break break
finally:
f.close()
except IOError: except IOError:
time.sleep(1) time.sleep(1)
pass pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment