1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| >>> import ftplib
>>> f = ftplib.FTP()
>>> f.connect('192.168.2.200', 2121)
'220 ProFTPD 1.3.2rc1 Server (NETGEAR ReadyNAS) [xx.xx.xxx.xxx]'
>>> f.login('xxxxxxxx', 'xxxxxxxxx')
'230 User xxxxxxxx logged in'
>>> lst = []
>>> f.retrbinary('LIST /', lst.append)
Traceback (most recent call last):
File "<pyshell#20>", line 1, in <module>
f.retrbinary('LIST /', lst.append)
File "C:\Python25\lib\ftplib.py", line 390, in retrbinary
conn = self.transfercmd(cmd, rest)
File "C:\Python25\lib\ftplib.py", line 356, in transfercmd
return self.ntransfercmd(cmd, rest)[0]
File "C:\Python25\lib\ftplib.py", line 324, in ntransfercmd
conn.connect(sa)
File "<string>", line 1, in connect
error: (10061, 'Connection refused') |
Partager