Sys.stdout in python cause cmd to hang when used more than 1000 times -
i want use sys.stdout
show progress. there no percentage since don't , can't know max value, can't use progress bar library.
the problem is, need call sys.stdout.write()
more 1000 times, , makes command line irresponsive. won't respond keyboardinterrupt
. problem not happen print though, kind of want use sys.stdout
since might logging.
here code:
while len(self.tocrawl) != 0: self.__crawling() sys.stdout.write('crawled {} urls!\r'.format(self.nb_url)) sys.stdout.flush()
Comments
Post a Comment