我确信这个问题已经解决,但我似乎无法找到类似的问题使用Windows XP和Python 2.5,我尝试使用脚本连接到FTP服务器并下载文件。它应该是简单的,但以下类似的脚本的指示,我得到的错误:Python 2.5脚本连接到FTP并下载文件
ftp.login('USERNAME')
File "C:\Python25\lib\ftplib.py", line 373, in login
if resp[0] == '3': resp = self.sendcmd('PASS ' + passwd)
File "C:\Python25\lib\ftplib.py", line 241, in sendcmd
return self.getresp()
File "C:\Python25\lib\ftplib.py", line 216, in getresp
raise error_perm, resp
error_perm: 530 User USERNAME cannot log in.
我使用的脚本是:
def handleDownload(block):
file.write(block)
print ".",
# Create an instance of the FTP object
# FTP('hostname', 'username', 'password')
ftp = FTP('servername')
print 'ftplib example'
# Log in to the server
print 'Logging in.'
# You can specify username and password here if you like:
ftp.login('USERNAME', 'password')
#print ftp.login()
# This is the directory
directory = '/GIS/test/data'
# Change to that directory.
print 'Changing to ' + directory
ftp.cwd(directory)
# Print the contents of the directory
ftp.retrlines('LIST')
我很欣赏这可能是一个微不足道的问题,但如果有人可以提供一些见解,这将是非常有益的!
感谢,S