diff --git a/cache.py b/cache.py index 36b45b26..5b9dbe42 100644 --- a/cache.py +++ b/cache.py @@ -37,8 +37,14 @@ def getPersonFromCache(baseDir: str,personUrl: str,personCache: {}) -> {}: if not personCache.get(personUrl): cacheFilename=baseDir+'/cache/actors/'+personUrl.replace('/','#')+'.json' if os.path.isfile(cacheFilename): - with open(cacheFilename, 'r') as fp: - personJson=commentjson.load(fp) + personJson=None + try: + with open(cacheFilename, 'r') as fp: + personJson=commentjson.load(fp) + except Exception as e: + print('ERROR: unable to load actor from cache '+cacheFilename) + print(e) + if personJson: storePersonInCache(baseDir,personUrl,personJson,personCache) loadedFromFile=True