socket.gaierror: [Errno 11001] getaddrinfo failed

前端 未结 8 1954
北海茫月
北海茫月 2021-01-06 08:33

I have tried to attached a file to the mail using python. Code:

import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIME         


        
8条回答
  •  没有蜡笔的小新
    2021-01-06 09:13

    In my case was a host problem. Using debug mode, I spotted that in (host, port, 0, SOCK_STREAM) I got host=local and it should be host=localhost. In the run.py I defined localhost and the file hosts (c:\windows\system32\drivers\etc\hosts) was defined local. They have to be equal, otherwise you get the socket.gaieeror.

提交回复
热议问题