python 出现socket.gaierror: [Errno 11004] getaddrinfo failed错误

python 出现socket.gaierror: [Errno 11004] getaddrinfo failed错误

报错详情:
…Traceback (most recent call last):
File “D:/JiCaiZhuanTi/Case/All_run_test.py”, line 48, in
SendEmail.send_file(new_repor)
File “D:\JiCaiZhuanTi\Case\public_keyword\SendEmail.py”, line 43, in send_file
smtp.connect(smtpserver)
File “C:\Python34\lib\smtplib.py”, line 321, in connect
self.sock = self._get_socket(host, port, self.timeout)
File “C:\Python34\lib\smtplib.py”, line 292, in _get_socket
self.source_address)
File “C:\Python34\lib\socket.py”, line 491, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File “C:\Python34\lib\socket.py”, line 530, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11004] getaddrinfo failed

Process finished with exit code 1

网上查了好多原因,说是网络问题或dns问题后来我对了一下别人写的代码我的错误如下:
python 出现socket.gaierror: [Errno 11004] getaddrinfo failed错误_第1张图片 smtpserver = 'smtp.exmail.163.com’实际上是这句话错误,改成
smtpserver = ‘smtp.exmail.163.com’
就解决了这个问题。

你可能感兴趣的:(python)