diff --git a/announce.py b/announce.py index c3468efe8..1d77187a3 100644 --- a/announce.py +++ b/announce.py @@ -76,7 +76,7 @@ def undoAnnounceCollectionEntry(postFilename: str,actor: str,debug: bool) -> Non postJsonObject=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception undoAnnounceCollectionEntry - '+e) time.sleep(2) tries+=1 if postJsonObject: @@ -138,7 +138,7 @@ def updateAnnounceCollection(postFilename: str,actor: str,debug: bool) -> None: postJsonObject=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception updateAnnounceCollection - '+e) time.sleep(1) tries+=1 if postJsonObject: diff --git a/availability.py b/availability.py index 2fe8acd86..32bbe34e1 100644 --- a/availability.py +++ b/availability.py @@ -35,7 +35,7 @@ def setAvailability(baseDir: str,nickname: str,domain: str, \ actorJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception setAvailability - '+e) time.sleep(1) tries+=1 if actorJson: @@ -66,7 +66,7 @@ def getAvailability(baseDir: str,nickname: str,domain: str) -> str: actorJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception getAvailability - '+e) time.sleep(1) tries+=1 if actorJson: diff --git a/cache.py b/cache.py index 4dd8cc571..eab98fbbf 100644 --- a/cache.py +++ b/cache.py @@ -53,6 +53,7 @@ def getPersonFromCache(baseDir: str,personUrl: str,personCache: {}) -> {}: personJson=commentjson.load(fp) break except Exception as e: + print('WARN: commentjson exception getPersonFromCache - '+e) print('ERROR: unable to load actor from cache '+cacheFilename+' try '+str(tries)) print(e) time.sleep(1) diff --git a/capabilities.py b/capabilities.py index f79dce3b4..a72e32713 100644 --- a/capabilities.py +++ b/capabilities.py @@ -134,7 +134,7 @@ def capabilitiesAccept(baseDir: str,httpPrefix: str, \ ocapAccept=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception capabilitiesAccept - '+e) time.sleep(1) tries+=1 # otherwise create a new capability @@ -239,7 +239,7 @@ def capabilitiesUpdate(baseDir: str,httpPrefix: str, \ ocapJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception capabilitiesUpdate - '+e) time.sleep(1) tries+=1 @@ -299,7 +299,7 @@ def capabilitiesReceiveUpdate(baseDir :str, \ ocapJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception capabilitiesReceiveUpdate - '+e) time.sleep(1) tries+=1 diff --git a/config.py b/config.py index 49b8d2744..a0cb732c9 100644 --- a/config.py +++ b/config.py @@ -42,7 +42,7 @@ def setConfigParam(baseDir: str, variableName: str, variableValue) -> None: configJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception setConfigParam - '+e) time.sleep(1) tries+=1 configJson[variableName]=variableValue @@ -71,7 +71,7 @@ def getConfigParam(baseDir: str, variableName: str): return configJson[variableName] break except Exception as e: - print(e) + print('WARN: commentjson exception getConfigParam - '+e) time.sleep(1) tries+=1 return None diff --git a/content.py b/content.py index 5a526270e..89ae0cdbf 100644 --- a/content.py +++ b/content.py @@ -326,6 +326,7 @@ def addHtmlTags(baseDir: str,httpPrefix: str, \ print('emojiDict loaded on try '+str(emojiDictCtr)) break except Exception as e: + print('WARN: commentjson exception addHtmlTags - '+e) print('Failed to load emoji (try '+str(emojiDictCtr)+'): '+baseDir+'/emoji/emoji.json '+str(e)) time.sleep(1) emojiDictCtr+=1 diff --git a/daemon.py b/daemon.py index f5d906fb7..a5f321c9e 100644 --- a/daemon.py +++ b/daemon.py @@ -1717,7 +1717,7 @@ class PubServer(BaseHTTPRequestHandler): loadedPost=True break except Exception as e: - print(e) + print('WARN: commentjson exception 1 - '+e) time.sleep(1) tries+=1 if loadedPost: @@ -1919,7 +1919,7 @@ class PubServer(BaseHTTPRequestHandler): loadedActor=True break except Exception as e: - print(e) + print('WARN: commentjson exception 2 - '+e) time.sleep(1) tries+=1 if loadedActor: @@ -1986,7 +1986,7 @@ class PubServer(BaseHTTPRequestHandler): loadedActor=True break except Exception as e: - print(e) + print('WARN: commentjson exception 3 - '+e) time.sleep(1) tries+=1 if loadedActor: @@ -2063,7 +2063,7 @@ class PubServer(BaseHTTPRequestHandler): readPost=True break except Exception as e: - print(e) + print('WARN: commentjson exception 4 - '+e) time.sleep(1) tries+=1 if not readPost: @@ -3468,7 +3468,7 @@ class PubServer(BaseHTTPRequestHandler): loadedActor=True break except Exception as e: - print(e) + print('WARN: commentjson exception 5 - '+e) time.sleep(1) tries+=1 if loadedActor: @@ -4686,6 +4686,7 @@ def runDaemon(projectVersion, \ httpd.translate=commentjson.load(fp) break except Exception as e: + print('WARN: commentjson exception 7 - '+e) print('ERROR while loading translations '+translationsFile) print(e) time.sleep(1) diff --git a/follow.py b/follow.py index 3f5ed3df7..aeadd7e80 100644 --- a/follow.py +++ b/follow.py @@ -345,7 +345,7 @@ def followApprovalRequired(baseDir: str,nicknameToFollow: str, \ actor=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception followApprovalRequired - '+e) time.sleep(1) tries+=1 if actor: @@ -882,7 +882,7 @@ def getFollowersOfActor(baseDir :str,actor :str,debug: bool) -> {}: ocapJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception getFollowersOfActor - '+e) time.sleep(1) tries+=1 if ocapJson: diff --git a/inbox.py b/inbox.py index 892a075c8..f8a932d2b 100644 --- a/inbox.py +++ b/inbox.py @@ -327,7 +327,7 @@ def inboxCheckCapabilities(baseDir :str,nickname :str,domain :str, \ oc=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception inboxCheckCapabilities - '+e) time.sleep(1) tries+=1 if not oc: @@ -404,7 +404,7 @@ def inboxPostRecipientsAdd(baseDir :str,httpPrefix :str,toList :[], \ loadedOcap=True break except Exception as e: - print(e) + print('WARN: commentjson exception inboxPostRecipientsAdd - '+e) time.sleep(1) tries+=1 if loadedOcap: @@ -695,7 +695,7 @@ def personReceiveUpdate(baseDir: str, \ loadedActor=True break except Exception as e: - print(e) + print('WARN: commentjson exception personReceiveUpdate - '+e) time.sleep(1) tries+=1 if loadedActor: @@ -1111,7 +1111,7 @@ def receiveUndoAnnounce(session,handle: str,isGroup: bool,baseDir: str, \ loadedPost=True break except Exception as e: - print(e) + print('WARN: commentjson exception receiveUndoAnnounce - '+e) time.sleep(1) tries+=1 if loadedPost: @@ -1301,7 +1301,7 @@ def groupHandle(baseDir: str,handle: str) -> bool: actorJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception groupHandle - '+e) time.sleep(1) tries+=1 if not actorJson: @@ -1322,7 +1322,7 @@ def getGroupName(baseDir: str,handle: str) -> str: actorJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception getGroupName - '+e) time.sleep(1) tries+=1 if not actorJson: @@ -1704,8 +1704,9 @@ def runInboxQueue(projectVersion: str, \ try: with open(queueFilename, 'r') as fp: queueJson=commentjson.load(fp) - except: + except Exception as e: itemReadFailed+=1 + print('WARN: commentjson exception runInboxQueue - '+e) print('WARN: Failed to load inbox queue item '+queueFilename+' (try '+str(itemReadFailed)+')') if itemReadFailed>4: # After a few tries we can assume that the file diff --git a/like.py b/like.py index ed671a8ea..eb8202c73 100644 --- a/like.py +++ b/like.py @@ -31,7 +31,7 @@ def undoLikesCollectionEntry(postFilename: str,objectUrl: str,actor: str,debug: postJsonObject=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception undoLikesCollectionEntry - '+e) time.sleep(1) tries+=1 @@ -121,7 +121,7 @@ def updateLikesCollection(postFilename: str,objectUrl: str, actor: str,debug: bo postJsonObject=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception updateLikesCollection - '+e) time.sleep(1) tries+=1 diff --git a/manualapprove.py b/manualapprove.py index 2e3dd7fa5..5bc527246 100644 --- a/manualapprove.py +++ b/manualapprove.py @@ -105,7 +105,7 @@ def manualApproveFollowRequest(session,baseDir: str, \ followJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception manualApproveFollowRequest - '+e) time.sleep(1) tries+=1 if followJson: diff --git a/person.py b/person.py index e985918d7..793694b57 100644 --- a/person.py +++ b/person.py @@ -99,7 +99,7 @@ def setProfileImage(baseDir: str,httpPrefix :str,nickname: str,domain: str, \ personJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception setProfileImage - '+e) time.sleep(1) tries+=1 @@ -144,7 +144,7 @@ def setOrganizationScheme(baseDir: str,nickname: str,domain: str, \ actorJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception setOrganizationScheme - '+e) time.sleep(1) tries+=1 @@ -460,7 +460,8 @@ def personLookup(domain: str,path: str,baseDir: str) -> {}: with open(filename, 'r') as fp: personJson=commentjson.load(fp) break - except: + except Exception as e: + print('WARN: commentjson exception personLookup - '+e) print('WARN: Failed to load actor '+filename) time.sleep(1) tries+=1 @@ -585,7 +586,7 @@ def setDisplayNickname(baseDir: str,nickname: str, domain: str, \ personJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception setDisplayNickname - '+e) time.sleep(1) tries+=1 @@ -620,7 +621,7 @@ def setBio(baseDir: str,nickname: str, domain: str, bio: str) -> bool: personJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception setBio - '+e) time.sleep(1) tries+=1 diff --git a/posts.py b/posts.py index 93f6d302f..84707f4f8 100644 --- a/posts.py +++ b/posts.py @@ -529,7 +529,7 @@ def createPostBase(baseDir: str,nickname: str, domain: str, port: int, \ replyToJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception createPostBase - '+e) time.sleep(1) tries+=1 if replyToJson: @@ -585,7 +585,7 @@ def createPostBase(baseDir: str,nickname: str, domain: str, port: int, \ capabilityIdList=[oc['id']] break except Exception as e: - print(e) + print('WARN: commentjson exception createPostBase - '+e) time.sleep(1) tries+=1 newPost = { @@ -1784,7 +1784,7 @@ def createModeration(baseDir: str,nickname: str,domain: str,port: int,httpPrefix boxItems['orderedItems'].append(postJsonObject) break except Exception as e: - print(e) + print('WARN: commentjson exception createModeration - '+e) time.sleep(1) tries+=1 @@ -1946,7 +1946,7 @@ def createBoxBase(session,baseDir: str,boxname: str, \ loadedPost=True break except Exception as e: - print(e) + print('WARN: commentjson exception createBoxBase - '+e) time.sleep(1) tries+=1 if loadedPost: @@ -1974,7 +1974,7 @@ def createBoxBase(session,baseDir: str,boxname: str, \ loadedOcap=True break except Exception as e: - print(e) + print('WARN: commentjson exception createBoxBase - '+e) time.sleep(1) tries+=1 if loadedOcap: @@ -2294,7 +2294,7 @@ def populateRepliesJson(baseDir: str,nickname: str,domain: str, \ loadedPost=True break except Exception as e: - print(e) + print('WARN: commentjson exception populateRepliesJson - '+e) time.sleep(1) tries+=1 if loadedPost: @@ -2330,7 +2330,7 @@ def populateRepliesJson(baseDir: str,nickname: str,domain: str, \ loadedPost=True break except Exception as e: - print(e) + print('WARN: commentjson exception populateRepliesJson 2 - '+e) time.sleep(1) tries+=1 if loadedPost: @@ -2379,7 +2379,7 @@ def downloadAnnounce(session,baseDir: str,httpPrefix: str,nickname: str,domain: postJsonObject=commentjson.load(fp) return postJsonObject except Exception as e: - print(e) + print('WARN: commentjson exception downloadAnnounce - '+e) time.sleep(1) tries+=1 else: diff --git a/roles.py b/roles.py index 40e71a020..874ed6459 100644 --- a/roles.py +++ b/roles.py @@ -37,7 +37,7 @@ def clearModeratorStatus(baseDir: str) -> None: actorJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception clearModeratorStatus - '+e) time.sleep(1) tries+=1 @@ -116,7 +116,7 @@ def setRole(baseDir: str,nickname: str,domain: str, \ actorJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception setRole - '+e) time.sleep(1) tries+=1 @@ -167,7 +167,7 @@ def getRoles(baseDir: str,nickname: str,domain: str, \ actorJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception getRoles - '+e) time.sleep(1) tries+=1 diff --git a/shares.py b/shares.py index 1ac0e9421..231a84430 100644 --- a/shares.py +++ b/shares.py @@ -33,7 +33,7 @@ def removeShare(baseDir: str,nickname: str,domain: str, \ sharesJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception removeShare - '+e) time.sleep(1) tries+=1 @@ -83,7 +83,7 @@ def addShare(baseDir: str, \ sharesJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception addShare - '+e) time.sleep(1) tries+=1 @@ -189,7 +189,7 @@ def expireShares(baseDir: str,nickname: str,domain: str) -> None: sharesJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception expireShares - '+e) time.sleep(1) tries+=1 if sharesJson: @@ -277,7 +277,7 @@ def getSharesFeedForPerson(baseDir: str, \ noOfShares=len(sharesJson.items()) break except Exception as e: - print(e) + print('WARN: commentjson exception getSharesFeedForPerson - '+e) time.sleep(1) tries+=1 shares = { @@ -315,7 +315,7 @@ def getSharesFeedForPerson(baseDir: str, \ sharesJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception getSharesFeedForPerson 2 - '+e) time.sleep(1) tries+=1 diff --git a/skills.py b/skills.py index 64d621f4d..f06d6c7cd 100644 --- a/skills.py +++ b/skills.py @@ -36,7 +36,7 @@ def setSkillLevel(baseDir: str,nickname: str,domain: str, \ actorJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception setSkillLevel - '+e) time.sleep(1) tries+=1 @@ -72,7 +72,7 @@ def setSkills(baseDir: str,nickname: str,domain: str,skills: {}) -> None: actorJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception setSkills - '+e) time.sleep(1) tries+=1 @@ -104,7 +104,7 @@ def getSkills(baseDir: str,nickname: str,domain: str) -> []: actorJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception getSkills - '+e) time.sleep(1) tries+=1 diff --git a/webfinger.py b/webfinger.py index 5a5e6c172..6b3d5ca38 100644 --- a/webfinger.py +++ b/webfinger.py @@ -240,7 +240,7 @@ def webfingerLookup(path: str,baseDir: str,port: int,debug: bool) -> {}: wfJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception webfingerLookup - '+e) time.sleep(1) tries+=1 return wfJson diff --git a/webinterface.py b/webinterface.py index 89c1c69df..590405c8e 100644 --- a/webinterface.py +++ b/webinterface.py @@ -158,7 +158,7 @@ def htmlSearchEmoji(translate: {},baseDir: str,searchStr: str) -> str: loadedEmoji=True break except Exception as e: - print(e) + print('WARN: commentjson exception htmlSearchEmoji - '+e) time.sleep(1) tries+=1 if loadedEmoji: @@ -231,7 +231,7 @@ def htmlSearchSharedItems(translate: {}, \ sharesJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception htmlSearchSharedItems - '+e) time.sleep(1) tries+=1 if not sharesJson: @@ -398,7 +398,7 @@ def htmlHashtagSearch(translate: {}, \ loadedPost=True break except Exception as e: - print(e) + print('WARN: commentjson exception htmlHashtagSearch - '+e) time.sleep(1) tries+=1 if loadedPost: @@ -450,7 +450,7 @@ def htmlSkillsSearch(translate: {},baseDir: str, \ loadedActor=True break except Exception as e: - print(e) + print('WARN: commentjson exception htmlSkillsSearch - '+e) time.sleep(1) tries+=1 if loadedActor: @@ -490,7 +490,7 @@ def htmlSkillsSearch(translate: {},baseDir: str, \ loadedActor=True break except Exception as e: - print(e) + print('WARN: commentjson exception htmlSkillsSearch - '+e) time.sleep(1) tries+=1 if loadedActor: @@ -576,7 +576,7 @@ def htmlEditProfile(translate: {},baseDir: str,path: str,domain: str,port: int) loadedActor=True break except Exception as e: - print(e) + print('WARN: commentjson exception htmlEditProfile - '+e) time.sleep(1) tries+=1 if loadedActor: @@ -1626,7 +1626,7 @@ def followerApprovalActive(baseDir: str,nickname: str,domain: str) -> bool: loadedActor=True break except Exception as e: - print(e) + print('WARN: commentjson exception followerApprovalActive - '+e) time.sleep(1) tries+=1 if loadedActor: @@ -2376,7 +2376,7 @@ def htmlIndividualPost(translate: {}, \ loadedPost=True break except Exception as e: - print(e) + print('WARN: commentjson exception htmlIndividualPost - '+e) time.sleep(1) tries+=1 if loadedPost: @@ -2452,7 +2452,7 @@ def htmlRemoveSharedItem(translate: {},baseDir: str,actor: str,shareName: str) - sharesJson=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception htmlRemoveSharedItem - '+e) time.sleep(1) tries+=1 @@ -2519,7 +2519,7 @@ def htmlDeletePost(translate,pageNumber: int, \ postJsonObject=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception htmlDeletePost - '+e) time.sleep(1) tries+=1 if not postJsonObject: @@ -2834,7 +2834,7 @@ def getCalendarEvents(baseDir: str,nickname: str,domain: str,year: int,monthNumb postJsonObject=commentjson.load(fp) break except Exception as e: - print(e) + print('WARN: commentjson exception getCalendarEvents - '+e) time.sleep(1) tries+=1 if postJsonObject: