ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
Re: threads and os.spawnlp on Linux
by Ram other posts by this author
Jul 1 2003 4:31PM messages near this date
Python -> To Exe or/and Elf | Python 2.0 / Python 2.2
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
-- 
http://mail.python.org/mailman/listinfo/python-list

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved