我使用的是Python DNS库(pydns 2.3.6 : Python Package Index),我收到了以下错误:
Traceback (most recent call last):
File "3.py", line 8, in <module>
if validate_email(line[0],check_mx=True,verify=False):
File "/usr/local/lib/python2.7/dist-packages/validate_email.py", line 134, in validate_email
mx_hosts = get_mx_ip(hostname)
File "/usr/local/lib/python2.7/dist-packages/validate_email.py", line 102, in get_mx_ip
MX_DNS_CACHE[hostname] = DNS.mxlookup(hostname)
File "/usr/local/lib/python2.7/dist-packages/DNS/lazy.py", line 51, in mxlookup
l = dnslookup(name, qtype = 'mx')
File "/usr/local/lib/python2.7/dist-packages/DNS/lazy.py", line 34, in dnslookup
result = Base.DnsRequest(name=name, qtype=qtype).req()
File "/usr/local/lib/python2.7/dist-packages/DNS/Base.py", line 231, in req
self.sendUDPRequest(server)
File "/usr/local/lib/python2.7/dist-packages/DNS/Base.py", line 260, in sendUDPRequest
r=self.processUDPReply()
File "/usr/local/lib/python2.7/dist-packages/DNS/Base.py", line 119, in processUDPReply
raise TimeoutError, 'Timeout'
DNS.Base.TimeoutError: Timeout
如何在脚本中处理此类错误?