mirror of https://gitlab.com/bashrc2/epicyon
Exception handling
parent
be75d250e0
commit
abdc0ad957
7
utils.py
7
utils.py
|
@ -263,8 +263,15 @@ def isDormant(baseDir: str, nickname: str, domain: str, actor: str,
|
||||||
if not os.path.isfile(lastSeenFilename):
|
if not os.path.isfile(lastSeenFilename):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
daysSinceEpochStr = None
|
||||||
|
try:
|
||||||
with open(lastSeenFilename, 'r') as lastSeenFile:
|
with open(lastSeenFilename, 'r') as lastSeenFile:
|
||||||
daysSinceEpochStr = lastSeenFile.read()
|
daysSinceEpochStr = lastSeenFile.read()
|
||||||
|
except OSError:
|
||||||
|
print('EX: failed to read last seen ' + lastSeenFilename)
|
||||||
|
return False
|
||||||
|
|
||||||
|
if daysSinceEpochStr:
|
||||||
daysSinceEpoch = int(daysSinceEpochStr)
|
daysSinceEpoch = int(daysSinceEpochStr)
|
||||||
currTime = datetime.datetime.utcnow()
|
currTime = datetime.datetime.utcnow()
|
||||||
currDaysSinceEpoch = (currTime - datetime.datetime(1970, 1, 1)).days
|
currDaysSinceEpoch = (currTime - datetime.datetime(1970, 1, 1)).days
|
||||||
|
|
Loading…
Reference in New Issue