运行main.py后出现这些问题该如何解决

来源:2-7 spider文件的编写(2)

QianGod

2018-08-13 17:30

Traceback (most recent call last):

  File "C:/Users/Administrator/douban/douban/spiders/main.py", line 3, in <module>

    cmdline.execute('scrapy crawl douban_spider'.split())

  File "C:\Python27\lib\site-packages\scrapy\cmdline.py", line 149, in execute

    cmd.crawler_process = CrawlerProcess(settings)

  File "C:\Python27\lib\site-packages\scrapy\crawler.py", line 249, in __init__

    super(CrawlerProcess, self).__init__(settings)

  File "C:\Python27\lib\site-packages\scrapy\crawler.py", line 137, in __init__

    self.spider_loader = _get_spider_loader(settings)

  File "C:\Python27\lib\site-packages\scrapy\crawler.py", line 336, in _get_spider_loader

    return loader_cls.from_settings(settings.frozencopy())

  File "C:\Python27\lib\site-packages\scrapy\spiderloader.py", line 61, in from_settings

    return cls(settings)

  File "C:\Python27\lib\site-packages\scrapy\spiderloader.py", line 25, in __init__

    self._load_all_spiders()

  File "C:\Python27\lib\site-packages\scrapy\spiderloader.py", line 47, in _load_all_spiders

    for module in walk_modules(name):

  File "C:\Python27\lib\site-packages\scrapy\utils\misc.py", line 71, in walk_modules

    submod = import_module(fullpath)

  File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module

    __import__(name)

  File "C:\Users\Administrator\douban\douban\spiders\douban_spider.py", line 31

    yield.scrapy.Request("https://movie.douban.com/top250" + next_link,callback=self.parse)

         ^

SyntaxError: invalid syntax



写回答 关注

1回答

  • 孤独的小猪
    2018-08-16 11:17:55

    你这个报的是语法错误,是不是缩进出现问题了

Python最火爬虫框架Scrapy入门与实践

做为爬虫工程师Python Scrapy主流爬虫框架你必须要会!

67418 学习 · 223 问题

查看课程

相似问题