Charles-Francois Natali <neolo...@free.fr> added the comment: The problem is due to the way urllib closes a FTP data transfer. The data channel is closed, and a shutdown hook is called that waits for a message on the control channel. But in that case, when the data connection is closed while the transfer is in progress, the server doesn't send any further message on the control channel, and we remain stuck (note that if the data channel is closed after the file has been transfered, in that case an end of transfer message is sent, which explains why this dones't happen with the sleep in between). The solution is to first wait for a message on the control channel, and then close the data channel (which makes sense, a close hook is generally called before closing the corresponding connection). The attached patch just does that. Note that I'm not sure why we need to wait for a further message on the control channel (maybe it's part of an RFC or something...).
---------- keywords: +patch nosy: +neologix Added file: http://bugs.python.org/file20814/urllib_ftp_close.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11199> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com