From 54a50a40b9b678579041e5a8eee2b61e77536aac Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Tue, 29 Nov 2016 20:36:13 +0100 Subject: [PATCH] [fix] at installation the cache dir might not be present --- moulinette/actionsmap.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/moulinette/actionsmap.py b/moulinette/actionsmap.py index 32390855..83ed60eb 100644 --- a/moulinette/actionsmap.py +++ b/moulinette/actionsmap.py @@ -523,10 +523,12 @@ class ActionsMap(object): with open(am_file, 'r') as f: actionsmaps[n] = yaml.load(f) - # clean old cached files - for i in os.listdir('%s/actionsmap/' % pkg.cachedir): - if i.endswith(".pkl"): - os.remove('%s/actionsmap/%s' % (pkg.cachedir, i)) + # at installation, cachedir might not exists + if os.path.exists('%s/actionsmap/' % pkg.cachedir): + # clean old cached files + for i in os.listdir('%s/actionsmap/' % pkg.cachedir): + if i.endswith(".pkl"): + os.remove('%s/actionsmap/%s' % (pkg.cachedir, i)) # Cache actions map into pickle file am_file_stat = os.stat(am_file)