Python FTP - NameError: name 'mydpa' is not defined

Harry laiyijia at
Mon Jul 28 15:27:31 CEST 2008

Hi there. I am trying to download a file(sn.last) from a public FTP 
server with the following code:

from ftplib import FTP
ftp.retrbinar('RETR sn.last', open(mydpa,'wb').write)

but got an error message, which I think is normal:

Traceback (most recent call last):
  File "<pyshell#13>", line 1, in <module>
    ftp.retrbinary('RETR sn.last', open(mydpa,'wb').write)
NameError: name 'mydpa' is not defined

I don't know much about python, but just try to use the code to 
download data. I don't know where the file will be saved to. Is the 
mydata a file name or a folder name? where will it be saved to even 
if it's working? Please help be fixed the problem step by step? I am 
using 2.5.2 by the way.

I really appreciate your help. Thanks.

More information about the Python-list mailing list