Hi All,
I'm trying to download a remote file through FTP. Here's the script:
###############################################################
#!/usr/bin/env python
import ftplib
import os
import time
ddir="C:\\ftp"
os.chdir(ddir)
f=ftplib.FTP("10.2.2.1", "user", "user123")
f.cwd("/home/protocol/cccdb/dumps/")
# define filename
day=time.strftime("%Y.%d.%m")
file2="mq20-%s-cdbdump.xml.md5" % (day)
#To debug
pwd = f.pwd()
print pwd
print file2
# get the remote file to the local directory
f.retrbinary('RETR %s' % file2, open(file2,"wb").write)
f.close()
###############################################################
*Output:*
>>> execfile("ftp.py")
/home/protocol/cccdb/dumps
mq20-2007.07.06-cdbdump.xml.md5
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "ftp.py", line 44, in ?
f.retrbinary('RETR %s' % file2, open(file2,"wb").write)
File "t:\Python23\lib\ftplib.py", line 379, in retrbinary
conn = self.transfercmd(cmd, rest)
File "t:\Python23\lib\ftplib.py", line 345, in transfercmd
return self.ntransfercmd(cmd, rest)[0]
File "t:\Python23\lib\ftplib.py", line 324, in ntransfercmd
conn.connect(sa)
File "<string>", line 1, in connect
socket.error: (10060, 'Operation timed out')
>>>
What's gone wrong?
Rgs,
Hrusi
*********************** Aricent-Unclassified ***********************
"DISCLAIMER: This message is proprietary to Aricent and is intended solely for
the use of
the individual to whom it is addressed. It may contain privileged or
confidential information and should not be
circulated or used for any purpose other than for what it is intended. If you
have received this message in error,
please notify the originator immediately. If you are not the intended
recipient, you are notified that you are strictly
prohibited from using, copying, altering, or disclosing the contents of this
message. Aricent accepts no responsibility for
loss or damage arising from the use of the information transmitted by this
email including damage from virus."
--
http://mail.python.org/mailman/listinfo/python-list