Reputation: 279
I'm trying to declare an object of a class that is defined in a local .py-file that I have not written myself. The declaration goes like this:
GPS_thread = GPS()
GPS_thread.run()
When it reaches the second line the program crashes and gives the error "AttributeError:_Thread__target". I have no idea what this means.
I have tried to look up other forum threads on similar subjects and found that they often recomend that I try to look for a local file called "threading" which is blocking the view of the proper file. The only thing I could fins was threading.pyc, the compiled version of threading.py, which is imported in the GPS-library. I deleted it, but that did not help.
Any advice?
Traceback (most recent call last):
File "C:\Users\Python\mscript\controlc.py", line 228, in <module>
main()
File "C:\Users\Python\mscript\controlc.py", line 140, in main
GPS_thread.run()
File "C:\Python27\lib\threading.py", line 767, in run
del self.__target, self.__args, self.__kwargs
AttributeError: _Thread__target
Upvotes: 0
Views: 1726
Reputation: 1853
run is what you override, but don't call: docs.
Use GPS_thread.start()
, this will fork and call GPS_thread.run
in the background. docs
Upvotes: 4