This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: set_daemon does not exist in Thread
Type: Stage:
Components: Documentation Versions: Python 3.0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: benjamin.peterson, georg.brandl, mnewman
Priority: normal Keywords:

Created on 2009-01-28 01:25 by mnewman, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
queue_join.py mnewman, 2009-01-28 01:25
Messages (2)
msg80686 - (view) Author: Michael Newman (mnewman) Date: 2009-01-28 01:25
This is related to:
http://bugs.python.org/issue3628
http://bugs.python.org/issue4808

I found in the example at the bottom of:
http://docs.python.org/3.0/library/queue.html
"t.set_daemon(True)"
won't work.

Python 3.0 (r30:67507, Dec  3 2008, 20:14:27) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from threading import Thread
>>> t = Thread()
>>> dir(t)
['_Thread__exc_info', '_Thread__initialized', '__class__',
'__delattr__', '__dic
t__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__',
'__gt__',
 '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__',
'__new__',
'__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__',
'__str__
', '__subclasshook__', '__weakref__', '_args', '_block', '_bootstrap',
'_bootstr
ap_inner', '_daemonic', '_delete', '_ident', '_initialized', '_kwargs',
'_name',
 '_note', '_set_daemon', '_started', '_stderr', '_stop', '_stopped',
'_target',
'_verbose', 'daemon', 'getName', 'ident', 'isAlive', 'isDaemon',
'is_alive', 'jo
in', 'name', 'run', 'setDaemon', 'setName', 'start']
>>> t.set_daemon(True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'Thread' object has no attribute 'set_daemon'
>>> t.daemon
False
# This appears to be the proper method, unless "set_daemon" gets added
in (or setDaemon is used, but that appears to be depreciated syntax):
>>> t.daemon = True
>>> t.daemon
True

Please see the attached "queue_join.py" for my own working example. It
would be helpful to include the line:
>>> from threading import Thread
in the official example.
msg80806 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-01-30 02:29
Fixed in r69114.
History
Date User Action Args
2022-04-11 14:56:44adminsetgithub: 49337
2009-01-30 02:29:58benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg80806
nosy: + benjamin.peterson
2009-01-28 04:15:21benjamin.petersonlinkissue5086 superseder
2009-01-28 01:25:28mnewmancreate