On Mon, Nov 12, 2012 at 8:25 PM, moonhkt <moon...@gmail.com> wrote: > On Nov 10, 2:50 pm, Steven D'Aprano <steve > +comp.lang.pyt...@pearwood.info> wrote: >> >> The same way you would skip any other error when you do something wrong: >> catch the exception. > > Thank. Added below. > try: > ftp = FTP(options.remote_host_address) > except : > print "Host address not found." > sys.exit(1)
Heh, I'm afraid that's not quite what Steven meant; what you're doing there is literally skipping _any other error_. A bare except is usually not a good thing. Catch the specific exception you want to catch - that way, if you typo a name or something, you don't get an obscure message about the host address when it's really a coding bug. ChrisA -- http://mail.python.org/mailman/listinfo/python-list