Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > ftplib question - ftp.dir() returns something and ftp.nlst() does not

Reply
Thread Tools

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

 
 
Nico Grubert
Guest
Posts: n/a
 
      11-24-2005
Hi there,

I am using the ftplib library to connect to a ftp server.
After I got connected, I can see a list of file in the current directory
using ftp.dir() or ftp.retrlines('LIST'). But using ftp.nlst() returns
an empty list which seems somehow strange to me. Here is, what I did:

>>> from ftplib import FTP
>>> HOST = 'my.server'
>>> USER = 'myuser'
>>> PASSWD = 'mypass'
>>> ftp = FTP(HOST, USER, PASSWD)
>>> ftp.set_pasv(0) # set active mode
>>> 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
>>>
>>> ftp.retrlines('LIST')

-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
'226 Transfer complete.'
>>>
>>> ftp.nlst()

[]
>>>


I thought "ftp.nlst()" would return the list ['member.dat',
'status.dat', 'debug.txt']. Any idea, what is going wrong here?

Nico
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ftplib returns EOFError Jon Bowlas Python 0 05-19-2008 11:27 AM
createImage sometime returns null and sometime returns non-null. vizlab Java 3 10-17-2007 11:21 AM
var Something= new Something() What does it mean ? pamelafluente@libero.it Javascript 9 10-05-2006 02:43 PM
Re: ftplib question - ftp.dir() returns something and ftp.nlst()does not Nico Grubert Python 0 11-25-2005 10:09 AM
Does FTPLIB have a 'local change directory' ? python newbie Python 4 08-07-2005 01:44 AM



Advertisments