[Twisted-Python] Ftp client

Andrew Bennetts andrew-twisted at puzzling.org
Wed Aug 3 11:21:48 EDT 2005


On Wed, Aug 03, 2005 at 04:53:34PM +0200, Michele Petrazzo wrote:
> Andrew Bennetts wrote:
[...]
> >
> >What specific problems are you having with twisted.protocols.ftp.FTPClient?
> >
> 
> I change the ftpclient example with this code:
> 
> def run():
>  # Create the client
>  creator = ClientCreator(reactor, FTPClient, user, passwd, 0)
>  creator.connectTCP('192.168.1.1', 4559).addCallback(connectionMade)
>  reactor.run()
> 
> def connectionMade(ftpClient):
>  # Get the current working directory
>  ftpClient.pwd().addCallbacks(success, fail)
> 
> 
> One problem is that if the user has no password, I receive an error [1] 
> (if I try to connect with a simple ftp client, when I connect to the 
> server, if it see that I have no password, it connect me without 
> password request), however if the user _has_ password, the client 
> connect correctly.

Before connecting, can you add:

    FTPClient.debug = True

Then we can see a full transcript of what's going on.

> Second:
> if the user _has_ password, so I can connect, I want to send "LIST 
> status" command, if I use:
> 
> ftpClient.queueStringCommand("LIST").addCallbacks(success, fail)
> 
> I receive [2], and if I use:

Right.  LIST requires a data connection to be established, and directly
issuing a LIST without arranging for a PASV or PORT command and associated
connection will fail.

> fileList = FTPFileListProtocol()
> d = ftpClient.list(' status ', fileList)
> d.addCallbacks(showFiles, fail, callbackArgs=(fileList,))
> 
> I receive [3]

Can you retry this with latest Twisted from SVN?  There's a bug in error
reporting and DeferredLists here that's been fixed in SVN that will make
this much clearer.

I don't understand why you're passing ' status ' instead of just 'status',
though.

-Andrew.





More information about the Twisted-Python mailing list