python - 为什么__del__不执行呢?
ringa_lee
ringa_lee 2017-04-18 10:31:27
0
1
451

新手用python2.7写的一个scrapy爬虫,希望爬虫退出去的时候清理打开的firefox进程,发现不管用,请帮忙看下,为什么最下面的self.browser.quit不执行呢

    def __init__(self):
        self.browser = webdriver.Firefox()


    def __del__(self):
        self.browser.quit()
ringa_lee
ringa_lee

ringa_lee

reply all(1)
刘奇
def spider_closed(self, spider):
    dosomething()

It seems that in scrapy you will be advised to do this scrapy: Call a function when a spider quits

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template