diff --git a/ispell.py b/ispell.py index 5fb2b96..7dd010f 100644 --- a/ispell.py +++ b/ispell.py @@ -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