<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>Hi all, </DIV>
<DIV> </DIV>
<DIV>I am trying to put together a script (Python 2.5, windows xp) that connects to an ftp server and retrieves/uploads files.</DIV>
<DIV> </DIV>
<DIV>I am sure what I have put together is completely insufficient and I get the errors:</DIV>
<DIV> </DIV>
<DIV>Traceback (most recent call last):<BR> File "C:\Documents and Settings\\Desktop\FTPDownload.py", line 19, in <module><BR> <A href="ftp://ftp.login('username'">ftp.login('username'</A>, 'password')<BR> File "C:\Python25\lib\ftplib.py", line 373, in login<BR> if resp[0] == '3': resp = self.sendcmd('PASS ' + passwd)<BR> File "C:\Python25\lib\ftplib.py", line 241, in sendcmd<BR> return self.getresp()<BR> File "C:\Python25\lib\ftplib.py", line 216, in getresp<BR> raise error_perm, resp<BR>error_perm: 530 User username cannot log in.</DIV>
<DIV> </DIV>
<DIV>The script I have so far is :</DIV>
<DIV> </DIV>
<DIV>from ftplib import FTP</DIV>
<DIV>def handleDownload(block):<BR> file.write(block)<BR> print ".",<BR> <BR>ftp = FTP('servername')</DIV>
<DIV># Log in to the server<BR>print 'Logging in.'<BR># Specify username and password <BR><A href="ftp://ftp.login('username'">ftp.login('username'</A>, 'password') <BR>print <A href="ftp://ftp.login">ftp.login</A>()</DIV>
<DIV>directory = '/test/ftp/'</DIV>
<DIV># Change to that directory. </DIV>
<DIV>print 'Changing to ' + directory<BR><A href="ftp://ftp.cwd(directory">ftp.cwd(directory</A>)</DIV>
<DIV># Print the contents of the directory<BR><A href="ftp://ftp.retrlines('LIST'">ftp.retrlines('LIST'</A>)</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>but i cannot even connect to the FTP not to mention upload/download anything...So any ideas or suggestions would be greatly appreciated.</DIV>
<DIV> </DIV>
<DIV>Thanks!</DIV>
<DIV> </DIV></td></tr></table><br>