我有一些使用ftplib连接到FTP服务器的代码。
ftp = ftplib.FTP("sceegnm_store.exactearth.com", user=config.ftp_user, passwd=config.ftp_pass)
此服务器是Intranet计算机。我可以ping主机名没问题,但我一直收到错误:
Traceback (most recent call last):
File "file_watcher.py", line 44, in main
ftp_watcher = FTPWatcher()
File "file_watcher.py", line 10, in __init__
self.ftplib = ftplib.FTP(host=config.ftp_host, user=config.ftp_user, passwd=config.ftp_pass)
File "/usr/lib/python2.7/ftplib.py", line 117, in __init__
self.connect(host)
File "/usr/lib/python2.7/ftplib.py", line 132, in connect
self.sock = socket.create_connection((self.host, self.port), self.timeout)
File "/usr/lib/python2.7/socket.py", line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno -2] Name or service not known
任何人都知道我为什么会遇到这个问题?