Interrupting ftplib.storbinary()

Larry Bates larry.bates at websafe.com
Thu Apr 26 10:49:42 EDT 2007


Florian Demmer wrote:
> Hi!
> 
> I have a number of ftp uploads running in parallel using
> ftplib.storbinary and threading and in case one of them fails I need
> to interrupt all the others (but not exit the program completely)...
> do you guys have an idea how i could implement the interruption as
> cleanly as possible?
> 
> thanks!
> 
I suspect that you would make a file-like object that has a read
method and pass it to storbinary instead of your normal fp argument.
Then you can signal it to stop gracefully.  Haven't tested, but
it should be easy to test.

-Larry



More information about the Python-list mailing list