Problem with FTPLib and incomplete files on some downloads

BJ Swope bigblueswope at gmail.com
Fri Jan 20 07:49:39 EST 2006


Just guessing but are the files binary yet you are downloading them without
declaring binary?

On 1/16/06, Peter A.Schott <paschott at no.yahoo.spamm.com> wrote:
>
> I download a lot of 4-6 KB files and regularly run into issues with files
> that
> don't get downloaded all the way or otherwise get corrupt.
>
> I do something like:
>
> RemoteList = nlstdir()
> for filename in RemoteList:
>   LocalFile = open(filename, "wb")
>   LocalFile.write( "get file code here" )
>   LocalFile.close()
>   #ftplib call to delete the remote file
>
> I've tried to insert a pause into the code between the close and the
> remote
> delete, but that doesn't seem to help.  For some reason it doesn't seem
> like the
> buffer is completely written or read before the remote delete is
> called.  That
> leads to a file that's not 100% complete and thus can't be decrypted.
>
> Any ideas on what to look for?  I don't have my exact code handy at the
> moment
> or I'd post some actual snippets.  It's also not consistent or it would be
> a
> whole lot easier to troubleshoot.  :-)
>
> Running Python 2.4.2 on Win32.
>
> Thanks.
>
> -Pete Schott
> --
> http://mail.python.org/mailman/listinfo/python-list
>



--
"But we also know the dangers of a religion that severs its links with
reason and becomes prey to fundamentalism" --  Cardinal Paul Poupard
"It morphs into the Republican party!"  -- BJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060120/88d179cf/attachment.html>


More information about the Python-list mailing list