我在不同的scrapy项目中有三个不同的蜘蛛,称为REsale,REbuy和RErent,每个都有自己的管道,将输出定向到我服务器上的各种MySQL表。使用scrapy crawl
调用时,它们都运行正常。最终,我想要一个可以在我的Windows 7机器上作为服务运行的脚本,它以不同的间隔运行蜘蛛。 ATM,我被困在scrapy API。我甚至无法让它运行其中一只蜘蛛!有什么特别的东西需要保存吗?目前它只在我的根python目录中。销售,购买和租赁是我使用scrapy crawl
调用的蜘蛛的名称,而sale_spider等是蜘蛛的.py文件。
from twisted.internet import reactor
from scrapy.crawler import Crawler
from scrapy.settings import Settings
from scrapy import log
from REsale.spiders.sale_spider import Sale
from REbuy.spiders.buy_spider import Buy
from RErent.spiders.sale_spider import Rent
spider = Buy()
crawler = Crawler(Settings())
crawler.configure()
crawler.crawl(spider)
crawler.start()
log.start()
reactor.run()
spider = Rent()
crawler = Crawler(Settings())
crawler.configure()
crawler.crawl(spider)
crawler.start()
log.start()
reactor.run()
spider = Sale()
crawler = Crawler(Settings())
crawler.configure()
crawler.crawl(spider)
crawler.start()
log.start()
reactor.run()
这将返回错误:
c:\Python27>File "real_project.py", line 5, in <module>
from REsale.spiders.sale_spider import Sale
ImportError: No module named REsale.spiders.sale_spider
我是新人,所以非常感谢任何帮助。