hi thanks for the replies. setting socket timeout works fine. I also find alternate way that perform the same thing,ie ftp connection timeout.
import ftplib f = ftplib.FTP("server_host_name", "TIMEOUT") thanks & regards ah On Wed, Sep 23, 2009 at 5:34 PM, Tim Golden <m...@timgolden.me.uk> wrote: > [copying back to the list] > > Please keep the conversation on-list, a h. We're all > happy to help you, but none of us is a private > consultant -- at least not an unpaid one! Also, > the more people who see what you post, the more > people there are who might be able to answer. > > a h wrote: > >> I have wriiten this piece of code which works fine. which retrieve files >> from server and dumping to the local folder >> >> import ftplib >> f = ftplib.FTP("server_host_name") >> while True: >> f.pwd() >> ... >> ...my logic >> f.retrbinary("RETR %s"% fname, myFile.write) >> ... >> >> but when disconnected say wire remove then it hang in loop, it does not >> throw any exception or any error. I traced by putting prints, and find >> that >> it hanged in ftp api call like "f.pwd() OR f.retrbinary()" and never >> return >> back >> > > > Did you try my suggestion of setting a socket timeout? > > > TJG > _______________________________________________ > python-win32 mailing list > python-win32@python.org > http://mail.python.org/mailman/listinfo/python-win32 >
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32