私は別の質問への答えStoppableThread
として提示されたクラスを使用しようとしています:
import threading
# Technique for creating a thread that can be stopped safely
# Posted by Bluebird75 on StackOverflow
class StoppableThread(threading.Thread):
"""Thread class with a stop() method. The thread itself has to check
regularly for the stopped() condition."""
def __init__(self):
super(StoppableThread, self).__init__()
self._stop = threading.Event()
def stop(self):
self._stop.set()
def stopped(self):
return self._stop.isSet()
ただし、次のようなものを実行すると、次のようになります。
st = StoppableThread(target=func)
私は得る:
TypeError:
__init__()
予期しないキーワード引数'target'を取得しました
おそらく、これをどのように使用すべきかについての見落としです。