[Twisted-Python] Ftp client
Andrew Bennetts
andrew-twisted at puzzling.org
Thu Aug 4 06:44:13 MDT 2005
On Thu, Aug 04, 2005 at 11:30:43AM +0200, Michele Petrazzo wrote:
> Andrew Bennetts wrote:
> >>>Before connecting, can you add:
> >>>
> >>>FTPClient.debug = True
> >>>
> >>>Then we can see a full transcript of what's going on.
> >>>
> >>
> >>I add that line, but I can't see any new line except that I already
> >>seen
> >
> >
> >Odd. It should log everything.
>
> Strange. Do you want that I change something to understand the problem?
> This happen also with the demo "ftpclient.py"!
If you can figure out why, I'd be happy, but I don't have time to
investigate right now (I'm quite busy atm, which is why my replies are so
brief, sorry).
> >>But what I receive is an empty file list
>
> >Perhaps FTPFileListProtocol can't parse your file listing -- it tries
> >to parse stuff more-or-less like:
> >
> >-rw-r--r-- 1 root other 531 Jan 29 03:26 README
> >
> >If you have another format, you'll need to write your own. As a
> >starting point, you could try:
> >
> >class LineRecorder(basic.LineReceiver): def connectionMade(self):
> >self.lines = [] def lineReceived(self,line): self.lines.append(line)
> >
> >Alternatively, subclass FTPFileListProtocol and override the
> >unknownLine method.
>
> With unknownLine overwritten I receive all the data correctly.
>
> What the are more right way (the advice method) to proceed? Simple
> override that method or create a new HylafaxFTPFileListProtocol ?
Create a new HylafaxFTPFileListProtocol would be simplest, I think.
> >Sorry, I was too hasty here -- you also need to change your errback
> >to print failure.subFailure or perhaps failure.subFailure.subFailure
> >rather than just failure.
>
> After some code tries, I receive this response:
> user login that has no password : [1]
Ok, so your FTP server requires a password.
> user login with password, list of not exist directory: [2]
Great, thanks for that output.
>
> Like you can see, I must find the return errors inside the failure
> instance at two differents point (I believe because, like you wrote,
> there are several layers). You think that this "problem" will be fixed
> in the future, for make the error more simple to understand?
Yes, it will, I'll file a bug on it so that I don't forget. Thanks for
uncovering it!
> I attach a diff file that solve my problem with the empty password and
> the "PASS" command. For me it work well. I'll very happy if you include
> my patch!
Interesting. Please file this at http://twistedmatrix.com/bugs, assign to
spiv. Also, please use unified diffs ("diff -u") if you can.
I think perhaps passing password=None might be a better way than
sendPass=False, I'll think about it.
Thank you very much!
-Andrew.
More information about the Twisted-Python
mailing list