Partial Upload With storbinary in python

Posted by brian on Stack Overflow See other posts from Stack Overflow or by brian
Published on 2009-03-21T22:02:27Z Indexed on 2010/12/28 21:54 UTC
Read the original article Hit count: 265

Filed under:
|
|

I've written some python code to download an image using

urllib.urlopen().read()

and then upload it to an FTP site using

ftplib.FTP().storbinary()

but I'm having a problem. Sometimes the image file is only partially uploaded, so I get images with the bottom 20% or so cut off. I've checked the locally downloaded version and I have successfully downloaded the entire image, which leads me to believe that it is a problem with storbinary. I believe I am opening and closing all of the files correctly. Does anyone have any clues as to why I'm getting a partial upload with storbinary?

Update: When I run through the commands in the Python shell, the upload completes successfully, I don't know why it would be different from when run as a script...

© Stack Overflow or respective owner

Related posts about python

Related posts about ftp