
Sometime I receive a strange error: File "hylaproto_t.pyo", line 209, in _RetrStatus File "twisted\protocols\ftp.pyo", line 2190, in list File "twisted\protocols\ftp.pyo", line 2006, in receiveFromConnection File "twisted\protocols\ftp.pyo", line 2081, in _openDataConnection File "twisted\protocols\ftp.pyo", line 1838, in queueCommand File "twisted\protocols\ftp.pyo", line 1819, in sendNextCommand File "twisted\protocols\ftp.pyo", line 2128, in generatePortCommand File "twisted\internet\tcp.pyo", line 591, in getHost AttributeError: 'Client' object has no attribute 'socket' At line 209 in hylaproto_t, I have: self._myClient.list('status', proto) self._myClient are an FTPClient instance. What can be the problem? Thanks, Michele

Your line numbers don't seem to match my plain twisted 2.4.0's...but the problem seems to occur on either of the last two lines of generatePortCommand in twisted.protocols.ftp factory = FTPDataPortFactory() factory.protocol = portCmd.protocol listener = reactor.listenTCP(0, factory) factory.port = listener # Ensure we close the listening port if something goes wrong def listenerFail(error, listener=listener): if listener.connected: listener.loseConnection() return error portCmd.fail = listenerFail # Construct crufty FTP magic numbers that represent host & port host = self.transport.getHost().host <<<< port = listener.getHost().port <<<<< Maybe either your control connection is not opened correctly (or already closed again), tcp.Port.socket only exists when the Port is actually connected.... Or, maybe your client data port couldn't be opened properly (possibly no more available ports?).... On Mon, 2006-07-10 at 16:43 +0200, Michele Petrazzo wrote:
Sometime I receive a strange error:
File "hylaproto_t.pyo", line 209, in _RetrStatus File "twisted\protocols\ftp.pyo", line 2190, in list File "twisted\protocols\ftp.pyo", line 2006, in receiveFromConnection File "twisted\protocols\ftp.pyo", line 2081, in _openDataConnection File "twisted\protocols\ftp.pyo", line 1838, in queueCommand File "twisted\protocols\ftp.pyo", line 1819, in sendNextCommand File "twisted\protocols\ftp.pyo", line 2128, in generatePortCommand File "twisted\internet\tcp.pyo", line 591, in getHost AttributeError: 'Client' object has no attribute 'socket'
At line 209 in hylaproto_t, I have: self._myClient.list('status', proto)
self._myClient are an FTPClient instance.
What can be the problem?
Thanks, Michele
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Thomas Jacob wrote:
Your line numbers don't seem to match my plain twisted 2.4.0's...
Ops, I was at 2.2 on my win machine, sorry.
but the problem seems to occur on either of the last two lines of generatePortCommand in twisted.protocols.ftp
<-cut->
Maybe either your control connection is not opened correctly (or already closed again), tcp.Port.socket only exists when the Port is actually connected....
Can be, I think, the connection closed by my code: into it, I close connection ( self._myClient.quit() ) when I receive an error (addErrback), but I have a "callLater" that are always running, so when called, it run the code that can generate that error. I think that I have to control the "internal connection state" before make a call to the ftp client. I'm right? Or is there a method for say to twisted to don't make calls (with the ftp protocol) when it aren't connected? P.s. Now I'm switching to twisted 2.4 :) Thanks, Michele

Can be, I think, the connection closed by my code: into it, I close connection ( self._myClient.quit() ) when I receive an error (addErrback), but I have a "callLater" that are always running, so when called, it run the code that can generate that error. I think that I have to control the "internal connection state" before make a call to the ftp client. I'm right? Or is there a method for say to twisted to don't make calls (with the ftp protocol) when it aren't connected?
Don't know, I am an (enthusiastic) twisted newbie as well, but probably you should do the first thing. You could for instance test whether or not <some tcp port>.connected is set, before you call ftp client functions functions.... that is check <ftpclient>.transport.connected...

On Mon, 10 Jul 2006 16:43:12 +0200, Michele Petrazzo <michele.petrazzo@unipex.it> wrote:
Sometime I receive a strange error:
File "hylaproto_t.pyo", line 209, in _RetrStatus File "twisted\protocols\ftp.pyo", line 2190, in list File "twisted\protocols\ftp.pyo", line 2006, in receiveFromConnection File "twisted\protocols\ftp.pyo", line 2081, in _openDataConnection File "twisted\protocols\ftp.pyo", line 1838, in queueCommand File "twisted\protocols\ftp.pyo", line 1819, in sendNextCommand File "twisted\protocols\ftp.pyo", line 2128, in generatePortCommand File "twisted\internet\tcp.pyo", line 591, in getHost AttributeError: 'Client' object has no attribute 'socket'
At line 209 in hylaproto_t, I have: self._myClient.list('status', proto)
self._myClient are an FTPClient instance.
What can be the problem?
This is most likely a bug in FTPClient. Could you file a ticket at http://twistedmatrix.com/trac/ (you need to register an account before the new ticket link will appear)? By only looking at the traceback, it is not entirely clear where the problem lies. Please include a minimal self-contained example which reproduces this traceback or a unit test which fails because of this problem. Jean-Paul

Jean-Paul Calderone wrote:
This is most likely a bug in FTPClient. Could you file a ticket at http://twistedmatrix.com/trac/ (you need to register an account before the new ticket link will appear)?
Done, ticket 1914.
By only looking at the traceback, it is not entirely clear where the problem lies. Please include a minimal self-contained example which reproduces this traceback or a unit test which fails because of this problem.
This is difficult to do, because it's a ftp client library that connect fax client to an hylafax server (that act like an ftp server), so you have to setup one for try... Of course, if you have one, I'll send you all the needs for try.
Jean-Paul
Thanks, Michele

On Tue, Jul 11, 2006 at 07:45:16PM +0200, Michele Petrazzo wrote: [...]
By only looking at the traceback, it is not entirely clear where the problem lies. Please include a minimal self-contained example which reproduces this traceback or a unit test which fails because of this problem.
This is difficult to do, because it's a ftp client library that connect fax client to an hylafax server (that act like an ftp server), so you have to setup one for try... Of course, if you have one, I'll send you all the needs for try.
FTP client tests don't necessary need a "real" FTP server to connect to -- and any test that does is certainly not a "unit" test. Often to test protocol logic all you need is a transcript of a session from a real server that you can play back to the client (not even necessarily over a real TCP connection). See test_ftp.py in Twisted for some examples of tests that don't need a full client and server on both ends to test behaviour. (And some that do, as well) -Andrew.
participants (4)
-
Andrew Bennetts
-
Jean-Paul Calderone
-
Michele Petrazzo
-
Thomas Jacob