From b5795709b0f1baef13b2d55f36599d5ff5a2c787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Sun, 25 Oct 2015 15:46:27 +0100 Subject: [PATCH] [fix] Properly close apps list json file --- list_builder.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/list_builder.py b/list_builder.py index 596aa18..4ca034c 100644 --- a/list_builder.py +++ b/list_builder.py @@ -1,13 +1,14 @@ #!/usr/bin/env python2 -import sys import os -import argparse +import sys import time import json +import argparse + import requests -import datetime from dateutil.parser import parse + # Create argument parser parser = argparse.ArgumentParser(description='Process YunoHost application list.') @@ -19,9 +20,10 @@ parser.add_argument("-g", "--github", help="Github token :") # Parse args args = parser.parse_args() -# Open list json file try: - apps_list = json.load(open(args.input)) + # Retrieve apps list from json file + with open(args.input) as f: + apps_list = json.load(f) except IOError as e: print "Error: %s file not found" % args.input sys.exit(1)