threads and os.spawnlp on Linux
Ram
utopia_2020 at hotmail.com
Tue Jul 1 12:31:39 EDT 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):
threading.Thread.__init__(self)
def run(self):
# Pinging some unreachable IP
os.system("ping -c 2 192.168.1.55")
print "done"
if __name__ == '__main__':
t = Child()
t.start()
Thanks
Ram
More information about the Python-list
mailing list