python - FTP OS.Walk goes into endless loop -
simply trying list files remote ftp folder contains 1 file (/public_html/data/ ['testfile.txt']
). os.walk returns same filename on , on in endless loop until don't manually interrupt. code is:
import ftptool f a_host = f.ftphost.connect("someftpsite", user="user", password="pass") (dirname, subdirs, files) in a_host.walk("/public_html/data"): print (dirname, files)
output looks this:
/public_html/data/ ['testfile.txt'] /public_html/data/ ['testfile.txt'] /public_html/data/ ['testfile.txt'] /public_html/data/ ['testfile.txt'] /public_html/data/ ['testfile.txt'] /public_html/data/ ['testfile.txt'] /public_html/data/ ['testfile.txt'] /public_html/data/ ['testfile.txt'] /public_html/data/ ['testfile.txt'] /public_html/data/ ['testfile.txt'] /public_html/data/ ['testfile.txt'] /public_html/data/ ['testfile.txt'] /public_html/data/ ['testfile.txt'] /public_html/data/ ['testfile.txt'] /public_html/data/ ['testfile.txt']
/// manually interrupted @ point///
i don't know sure, have @ subdirs. ftp server may returning '.' on listing, , looking @ ftptool code, may recur on again , again.
Comments
Post a Comment