我遇到的场景:
def weibo_spider():
......
schedule.every(10).minutes.do(weibo_spider())
while True:
schedule.run_pending()
具体报错:
File "D:\Temp\anaconda\lib\site-packages\schedule\__init__.py", line 625, in do
self.job_func = functools.partial(job_func, *args, **kwargs)
TypeError: the first argument must be callable
解决方案:
schedule.every(10).minutes.do(weibo_spider())
改为
schedule.every(10).minutes.do(weibo_spider)