RE: smtplib TimeoutError not catch

2016-10-12 Thread Joaquin Alzola
>Not surprisingly, the exception you should catch is simply TimeoutError: >try: >server.sendmail(sender, receivers, msg.as_string()) >except TimeoutError as e: >print("SMTP could not be contacted: %s" % e) >finally: > server.quit() The error was thrown by a

Re: smtplib TimeoutError not catch

2016-10-12 Thread MRAB
On 2016-10-12 14:21, Joaquin Alzola wrote: Hi Guys Try to connect to the smtp via smtplib. The connection is down because the Firewall has not been open yet so the exception is something that should appear. Now I want to catch this timeout in case error happens in future. Here the exception t