Threading: "no attribute '_Thread__thread'"?


#1

I’m attempting to use Panda’s threading implementation (as imported via " from direct.stdpy import threading"). When attempting to call the “isAlive()” method, I get the following error:

/home/thaumaturge/Documents/My Game Projects/Adventuring/GameCore.py", line 1018, in update
    if self.quickSaveThread is not None and not self.quickSaveThread.isAlive() and \
  File "/usr/local/lib/python3.6/dist-packages/direct/stdpy/threading.py", line 124, in is_alive
    thread = self.__thread
AttributeError: 'SavingThread' object has no attribute '_Thread__thread'
Traceback (most recent call last):
  File "/home/thaumaturge/Documents/My Game Projects/Adventuring/GameCore.py", line 1162, in <module>
    gameFramework.run()
  File "/usr/local/lib/python3.6/dist-packages/direct/showbase/ShowBase.py", line 3109, in run
    self.taskMgr.run()
  File "/usr/local/lib/python3.6/dist-packages/direct/task/Task.py", line 531, in run
    self.step()
  File "/usr/local/lib/python3.6/dist-packages/direct/task/Task.py", line 485, in step
    self.mgr.poll()
  File "/home/thaumaturge/Documents/My Game Projects/Adventuring/GameCore.py", line 1018, in update
    if self.quickSaveThread is not None and not self.quickSaveThread.isAlive() and \
  File "/usr/local/lib/python3.6/dist-packages/direct/stdpy/threading.py", line 124, in is_alive
    thread = self.__thread
AttributeError: 'SavingThread' object has no attribute '_Thread__thread'

Some quick searching turned up no apparent leads, but I may well have missed something–I did search only briefly. ^^;

Does anyone know what the problem here might be?


#2

I can only guess without seeing code, but did you perhaps inherit from Thread without upcalling to the super-class __init__ in your own constructor?


#3

Aaah, you’re right! I completely forgot that for some reason–a very silly mistake! ^^; Thank you for your help!