Linked Questions

0 votes
2 answers
927 views

How to force main thread to close if a sub thread is alive in python? sys.exit() and exit() appears to wait for sub thread to complete?
user3388884's user avatar
  • 5,158
1 vote
1 answer
158 views

I have a python script that starts a process using multiprocessing Process class. Inside that process I start a thread with an infinite loop, and I simulate an exception on the main thread by doing ...
Mihai's user avatar
  • 155
48 votes
4 answers
116k views

I'm looking to terminate some threads after a certain amount of time. These threads will be running an infinite while loop and during this time they can stall for a random, large amount of time. The ...
Takkun's user avatar
  • 8,769
87 votes
3 answers
123k views

I'm a little confused about what setting a thread to be a daemon means. The documentation says this: A thread can be flagged as a “daemon thread”. The significance of this flag is that the ...
Falmarri's user avatar
  • 48.7k
42 votes
5 answers
86k views

I am a newbie in python programming, what I understand is that a process can be a daemon, but a thread in a daemon mode, I couldn't understand the usecase of this, I would request the python gurus to ...
hue's user avatar
  • 1,807
31 votes
2 answers
15k views

It has been itching me for a long time to know what the historical reason for calling daemon programs or threads "daemon" Lat: daemon, latin version of the Greek "δαίμων" ("...
Sebastian Wozny's user avatar
19 votes
3 answers
6k views

I was really confused by sys.exit() in python. In python documentation, it says "Exit from Python"; does that mean when sys.exit() is called in a python program, the process will exit? If so, the code ...
wdy's user avatar
  • 331
11 votes
2 answers
12k views

from threading import Thread class MyClass: #... def method2(self): while True: try: hashes = self.target.bssid.replace(':','') + '.pixie' ...
psyskeptic's user avatar
10 votes
3 answers
18k views

I have found a code creating a timeout function here, which does not seem to work. The complete test code is below: def timeout(func, args=(), kwargs={}, timeout_duration=1, default=None): import ...
Alex's user avatar
  • 45k
3 votes
1 answer
2k views

I don't understand why "while True:" is needed in below example import os import sys import subprocess import time from threading import Thread from Queue import Queue def worker(): ...
Vjy's user avatar
  • 2,135
2 votes
3 answers
5k views

I just wrote a task queue in Python whose job is to limit the number of tasks that are run at one time. This is a little different than Queue.Queue because instead of limiting how many items can be in ...
Travis Parks's user avatar
  • 8,725
2 votes
4 answers
3k views

I have a function I'm calling every 5 seconds like such: def check_buzz(super_buzz_words): print 'Checking buzz' t = Timer(5.0, check_buzz, args=(super_buzz_words,)) t.dameon = True t....
user avatar
0 votes
2 answers
5k views

If I create a daemon thread in Python (3.6+) and that daemon thread is finished execution, are its resources automatically freed up, or is it a memory leak? I looked around couldn't really find the ...
Edwin Fernandez's user avatar
10 votes
4 answers
603 views

I wrote the code for a simple TCP client: from socket import * # Configurações de conexão do servidor # O nome do servidor pode ser o endereço de # IP ou o domínio (ola.python.net) serverHost = '...
Paul Sigonoso's user avatar
0 votes
1 answer
4k views

Though I googled and got a lot of result, but they are not what I want. My main code as below def main: start = datetime.now() browser = webdriver.PhantomJS() download() browser.quit()...
mikezang's user avatar
  • 2,509

15 30 50 per page