ftplib question - ftp.dir() returns something and ftp.nlst() does not

Nico Grubert nicogrubert at gmail.com
Fri Nov 25 05:09:25 EST 2005


 > it's not obvious how Python could translate '' to anything other
 > than an empty list, so it sure looks like a server issue.

 > (or is a problem with running in passive mode?  can you test with-
 > out using passive mode on the same server?)


I thought using "ftp.set_pasv(0)" sets active mode so I can use 
ftp.anyMethod() wihtout using passive mode?

I tried:

 >>> ftp.set_pasv(0)
 >>> ftp.nlst()
*cmd* 'TYPE A'
*put* 'TYPE A\r\n'
*get* '200 Type set to I.\r\n'
*resp* '200 Type set to I.'
*cmd* 'PORT 10,30,1,31,128,19'
*put* 'PORT 10,30,1,31,128,19\r\n'
*get* '200 PORT command Ok.\r\n'
*resp* '200 PORT command Ok.'
*cmd* 'NLST'
*put* 'NLST\r\n'
*get* '150 About to open data connection.\r\n'
*resp* '150 About to open data connection.'
*retr* ''
*get* '226 Transfer complete.\r\n'
*resp* '226 Transfer complete.'
[]
 >>> ftp.dir()
-r--r--r--   1 owner    group          121984 Nov 24 12:13 member.dat
-r--r--r--   1 owner    group             115 Nov 24 15:53 status.dat
-r--r--r--   1 owner    group             339 Nov 24 15:53 debug.txt
 >>>


Nico



More information about the Python-list mailing list