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)