Try to read a few times

main2
Bob Mottram 2019-10-11 18:03:07 +01:00
parent 1811298962
commit 2738dcbedf
1 changed files with 11 additions and 5 deletions

View File

@ -423,11 +423,17 @@ def personLookup(domain: str,path: str,baseDir: str) -> {}:
if not os.path.isfile(filename):
return None
personJson={"user": "unknown"}
tries=0
while tries<5:
try:
with open(filename, 'r') as fp:
personJson=commentjson.load(fp)
break
except:
print('WARN: Failed to load actor '+filename)
time.sleep(2)
tries+=1
if tries>=5:
return None
return personJson