ftplib retrlines timeout

Discussion in 'Python' started by Jennifer, Dec 15, 2009.

  1. Jennifer

    Jennifer Guest

    I am writing a program that has a requirement for a timeout of
    retrlines after the connection established. I just wonder if timeout
    of ftplib.FTP('xxxx.xxx.com',username,password,timeout) will work for
    retrlines method after the connection established. Or
    socket.setdefaulttimeout will work in this case. Please let me know.

    What exception will be throwed if ftp.retrlines timed out.

    Many Thanks!

    - Jennifer
    Jennifer, Dec 15, 2009
    #1
    1. Advertising

  2. Jennifer

    Brendan Guest

    On Dec 15, 6:17 pm, Jennifer <> wrote:
    > I am writing a program that has a requirement for  a timeout of
    > retrlines after the connection established. I just wonder if timeout
    > of ftplib.FTP('xxxx.xxx.com',username,password,timeout) will work for
    > retrlines method after the connection established. Or
    > socket.setdefaulttimeout will work in this case. Please let me know.
    >
    > What exception will be throwed if ftp.retrlines timed out.
    >
    > Many Thanks!
    >
    > - Jennifer


    I asked a similar question on here a few days ago and got no response,
    however I tried a large download which timed out with the following:
    Traceback (most recent call last):
    File "./download_r1_neodf.py", line 167, in <module>
    result = ftp.quit()
    File "/usr/local/lib/python2.6/ftplib.py", line 566, in quit
    resp = self.voidcmd('QUIT')
    File "/usr/local/lib/python2.6/ftplib.py", line 248, in voidcmd
    return self.voidresp()
    File "/usr/local/lib/python2.6/ftplib.py", line 223, in voidresp
    resp = self.getresp()
    File "/usr/local/lib/python2.6/ftplib.py", line 209, in getresp
    resp = self.getmultiline()
    File "/usr/local/lib/python2.6/ftplib.py", line 195, in getmultiline
    line = self.getline()
    File "/usr/local/lib/python2.6/ftplib.py", line 182, in getline
    line = self.file.readline()
    File "/usr/local/lib/python2.6/socket.py", line 406, in readline
    data = self._sock.recv(self._rbufsize)
    socket.error: [Errno 110] Connection timed out


    BTW, if you want to use the timeout paramter, you must also use the
    account parameter. Set it to ''.
    Brendan, Dec 16, 2009
    #2
    1. Advertising

  3. Jennifer

    Jennifer Guest

    So you mean ftplib.FTP('xxxx.xxx.com',username,password,timeout) will
    timeout the retrlines as well, correct? Thanks.
    Jennifer, Dec 16, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gabriel Genellina
    Replies:
    0
    Views:
    422
    Gabriel Genellina
    Jan 25, 2007
  2. Gabriel Genellina
    Replies:
    0
    Views:
    371
    Gabriel Genellina
    Jan 28, 2007
  3. Replies:
    2
    Views:
    615
    Peter Otten
    Dec 8, 2008
  4. Brendan
    Replies:
    4
    Views:
    2,009
    Giampaolo Rodola'
    Dec 30, 2009
  5. fabio.geraci

    FTP.retrlines help

    fabio.geraci, Jan 14, 2011, in forum: Python
    Replies:
    0
    Views:
    559
    fabio.geraci
    Jan 14, 2011
Loading...

Share This Page