threads and os.spawnlp on Linux

Ram utopia_2020 at
Tue Jul 1 18:31:39 CEST 2003

Some more info to add on ... the problem seems that if some system
call fails (or times out) in the os.system or os.spawnlp, then it
never returns back the execution context.

The following also causes similar results as before if the IP address
pinged is unreachable, but if it is a reachable IP, it returns
correctly. The problem occurs only if the os.system is inside the
thread class.

import os
import threading
import time

class Child(threading.Thread):
        def __init__(self):

        def run(self):
                # Pinging some unreachable IP
                os.system("ping -c 2") 
                print "done"

if __name__ == '__main__':
        t = Child()


More information about the Python-list mailing list