From 9fc251c11fabc492f5a64129d884f633879c381b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 27 Nov 2019 09:58:39 +0000 Subject: [PATCH] Check that questions file exists --- daemon.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/daemon.py b/daemon.py index 8393f6b5..bcdfdcba 100644 --- a/daemon.py +++ b/daemon.py @@ -194,10 +194,11 @@ class PubServer(BaseHTTPRequestHandler): self.server.baseDir+'/accounts/'+ \ nickname+'@'+self.server.domain+'/questions.txt' - # have we already voted on this? - if messageId in open(votesFilename).read(): - print('Already voted on message '+messageId) - return + if os.path.isfile(votesFilename): + # have we already voted on this? + if messageId in open(votesFilename).read(): + print('Already voted on message '+messageId) + return print('Voting on message '+messageId) print('Vote for: '+answer)