Skip to content
Snippets Groups Projects
Commit 6505b7b0 authored by Kevin Lyda's avatar Kevin Lyda :speech_balloon:
Browse files

Use a with statement.

parent 2a7214a3
Branches
No related tags found
No related merge requests found
......@@ -14,6 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# For Python 2.5
from __future__ import with_statement
"""Processes crontab files and try to catch common errors.
Parse crontab files and check each type of line for potential syntax errors.
......@@ -1024,7 +1027,8 @@ def CheckCrontab(crontab_file, log):
line_no = 0
cron_line_factory = CronLineFactory()
for line in open(crontab_file, 'r'):
with open(crontab_file, 'r') as crontab_f:
for line in crontab_f:
line = line.strip()
line_no += 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment