我確信這個問題已經解決,但我似乎無法找到類似的問題使用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