From f8233e34fffe9ce1d21cbfefd57b2a93975049aa Mon Sep 17 00:00:00 2001 From: Qiqi Gu Date: Mon, 9 Jul 2018 08:58:41 -0700 Subject: [PATCH] Fix TypeError: 'bool' object is not callable Thread has a method called stop, ActiveWFObject._stop will override the parent one. Therefore I have to rename _stop. --- 28-actors/tf-28.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/28-actors/tf-28.py b/28-actors/tf-28.py index 69f76c2..f6d3ecc 100755 --- a/28-actors/tf-28.py +++ b/28-actors/tf-28.py @@ -9,15 +9,15 @@ class ActiveWFObject(Thread): Thread.__init__(self) self.name = str(type(self)) self.queue = Queue() - self._stop = False + self._stopMe = False self.start() def run(self): - while not self._stop: + while not self._stopMe: message = self.queue.get() self._dispatch(message) if message[0] == 'die': - self._stop = True + self._stopMe = True def send(receiver, message): receiver.queue.put(message) @@ -116,7 +116,7 @@ class WordFrequencyController(ActiveWFObject): for (w, f) in word_freqs[0:25]: print w, ' - ', f send(self._storage_manager, ['die']) - self._stop = True + self._stopMe = True # # The main function