Code: Alles auswählen
from threading import Thread
class WorkerThread(Thread):
def run(self):
# Original ausm threading Modul
try:
if self.__target:
self.__target(*self.__args, **self.__kwargs)
finally:
# Avoid a refcycle if the thread is running a function with
# an argument that has a member that points to the thread.
del self.__target, self.__args, self.__kwargs
def worker():
while True: pass
thread = WorkerThread(target=worker)
thread.start()
Kann mir das einer erklären?Exception in thread Thread-1:
Traceback (most recent call last):
File "E:\Python27\lib\threading.py", line 552, in __bootstrap_inner
self.run()
File "G:\TEMP\blub.py", line 13, in run
del self.__target, self.__args, self.__kwargs
AttributeError: _WorkerThread__target