if self.hintstr is None or self.revealpossibilities is None or self.reveal is None:
oldhintstr = ""
self.hintstr = list(re.sub(r'[a-zA-Z0-9]', '*', answer))
- self.revealpossibilities = range(''.join(self.hintstr).count('*'))
+ self.revealpossibilities = list(range(''.join(self.hintstr).count('*')))
self.reveal = int(round(''.join(self.hintstr).count('*') * (7/24.0)))
else:
oldhintstr = ''.join(self.hintstr)
insertpos = f.tell()
fcontents = f.read()
f.seek(insertpos)
- f.write((self.db['hofformat']+"\n") % {
+ new_line = self.db['hofformat'] % {
'date': time.strftime("%F", time.gmtime()),
'duration': str(datetime.timedelta(seconds=time.time()-self.db['lastwon'])),
'targetscore': self.db['target'],
'secondscore': pts(1),
'thirdperson': person(2),
'thirdscore': pts(2),
- })
+ }
+ f.write(new_line.encode() + b"\n")
f.write(fcontents)
status = True
except Exception as e:
+ print(repr(e))
+ print(type(e))
+ print(e.message)
status = False
finally:
if f is not None: