tags:

views:

270

answers:

1

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...

A: 

It turns out I was not closing the downloaded file correctly. Let's all pretend this never happened.

brian
It would be helpful if you said how you actually solved the problem.
nbolton