From 767257659c788f7c57b28387aff1d04b3b073905 Mon Sep 17 00:00:00 2001 From: Shunichi Otsuka Date: Tue, 13 May 2014 01:23:33 +0900 Subject: [PATCH] avoid error when using module for the first time without having used battleschool before When battle hasn't been executed the file battleschool_extra_vars.json does not exist. Therefore it is necessary to check the existence of this file first. --- share/library/mac_pkg | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/share/library/mac_pkg b/share/library/mac_pkg index 0afb9d7..eec3008 100644 --- a/share/library/mac_pkg +++ b/share/library/mac_pkg @@ -519,9 +519,11 @@ class Installer(object): tempdir = tempfile.gettempdir() extra_vars_path = path.join(tempdir, "battleschool_extra_vars.json") -with open(extra_vars_path) as f: - extra_vars = json.load(f) - +if path.isfile(extra_vars_path): + with open(extra_vars_path) as f: + extra_vars = json.load(f) +else: + extra_vars = {} def get_env(name, default, converter = None): if name in extra_vars: