Johan Geldenhuys wrote: > I don't know if this will work in all cases. I tried it with a > internet connection and could get a 'OK' response. Then I tried it > withoput a internet connection and received a Traceback error, which is > not what I want. > > It gave me some idea what is possible.
The traceback is because the connection attempt raised an exception when it failed to connect. If you look at the kind of exception (printed in the traceback) you can catch it in your code and handle it a different way. For example, if the exception is urllib.error (just a guess!) then you would write try: # code to try the connection here except urllib.error: # code to handle the error goes here. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor