fix python 3 bugs

--HG--
branch : pmacs2
This commit is contained in:
~d6 2021-12-20 00:10:17 -05:00
parent 326a9c3409
commit a14e510a34
1 changed files with 5 additions and 4 deletions

View File

@ -60,17 +60,18 @@ class Speller(object):
if word in self.cache:
result = self.cache[word]
else:
if self.pipe.poll() >= 0:
res = self.pipe.poll()
if res is None or res >= 0:
self.pipe = None
self.start()
self.pipe.stdin.write("%s\n" % (word))
self.pipe.stdin.write(word.encode('utf-8') + b'\n') #"%s\n" % (word))
self.pipe.stdin.flush()
l = self.pipe.stdout.readline()
if l.startswith("*") or l.startswith("+") or l.startswith("-"):
if l.startswith(b"*") or l.startswith(b"+") or l.startswith(b"-"):
result = True
while True:
l = self.pipe.stdout.readline()
if l == "\n":
if l == b"\n":
break
self.cache[word] = result
return result