A very simple script.
test.py
import temp
temp.start()
temp.py
import threading, time
f=open("output.txt","w")
def temp():
for i in range(5):
f.write(str(i))
time.sleep(5)
f.close()
def start():
t=threading.Thread(target=temp)
t.setDaemon(True)
t.start()
I expected Daemon thread to complete as main process test.py
exits immediately.But the daemon
thread exits with the main and does not act like a daemon
.Am i missing something basic here?