Try to use sys.exit(0) Maybe you should print out the error in your except block.
2010/10/5, chad <cdal...@gmail.com>: > Given the following.. > > #!/usr/bin/python > > import urllib2 > import sys > import time > > while 1: > try: > con = urllib2.urlopen("http://www.google.com") > data = con.read() > print "connected" > #The loop doesn't exit if I use sys.exit(1) > break > except: > time.sleep(2) > > > If I would replace 'break' with 'sys.exit(1)', the while loop will > keep printing connected every 2 seconds? Why I this? I thought exit > meant exit. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list