ftplib - 226 message not received

B

Brendan

I am trying to download a file within a very large zipfile. I need two
partial downloads of the zipfile. The first to get the file byte
offset, the second to get the file itself which I then inflate.

I am implementing the partial downloads as follows:

con = ftp.transfercmd('RETR ' + filename, rest_offset) # the data
socket
while True:
block = con.recv(blocksize)
# stop transfer while it isn't finished yet
if bytes_recv >= buf_length:
break
elif not block:
break
buf = ''.join([buf, block])
bytes_recv += len(block)
con.close()

My problem is that even though the socket is closed, I have no way to
receive the 226 response from server so I can proceed with the next
download. Of course I could close the ftp connection entirely and
open a new one, but I am hoping to avoid doing so.
 
B

Brendan

Okay, found it on my own. ftp.voidresp() is what is needed, and it
does _not_ seem to be in the Python documentation for ftplib.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top