[Tutor] script ?

Dan Freeman danrfreeman at gmail.com
Mon Oct 29 20:46:06 CET 2007


How can I have this script exucute a .exe file instead of beeping the system
speaker?
__________________________________________

import os
import time

z = 2

while z ==2:

    connected = False
    while not connected:
        o=os.popen("netstat -an")
        for l in o:
            try:
                if l.split()[1].endswith("159.215.49.8.116:59999"):
                    print "\a\a\a\a\aMatch!"
                    connected = True
                else:
                    print "Nothing"
            except IndexError:
                print "Index Exception"
        time.sleep(1)

    amount=0
    while connected:
        o=os.popen("netstat -an")
        for l in o:
            try:
                if l.split()[1].endswith("159.215.49.8:59999"):
                    print "Still There"
                    connected = True
                    amount +=1
                    print amount
                else:
                    print "Nothing"
            except IndexError:
                print "Index Exception"
        time.sleep(1)
        if amount == 1:
            amount -=1
        else:
            print "It's Gone"
            connected = False

    print "\a\a"

raw_input("Press Enter to close")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071029/fc5acf24/attachment.htm 


More information about the Tutor mailing list