Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54621

Re: How To Build Scrapy Environment

From Peter Otten <__peter__@web.de>
Subject Re: How To Build Scrapy Environment
Date 2013-09-23 10:37 +0200
Organization None
References <1dad0f6e-0241-4892-ad32-afb2097f09a3@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.256.1379925407.18130.python-list@python.org> (permalink)

Show all headers | View raw


YetToCome wrote:

> I have already install Twisted, zope.interface, w3lib, libxml2, etc,but it
> still can not be built,here is the error message:
> 
> Traceback (most recent call last):
>   File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
>     "__main__", fname, loader, pkg_name)
>   File "C:\Python27\lib\runpy.py", line 72, in _run_code
>     exec code in run_globals
>   File "C:\Python27\lib\site-packages\scrapy\cmdline.py", line 167, in
>   <module>
>     execute()
>   File "C:\Python27\lib\site-packages\scrapy\cmdline.py", line 142, in
>   execute
>     _run_print_help(parser, _run_command, cmd, args, opts)
>   File "C:\Python27\lib\site-packages\scrapy\cmdline.py", line 88, in
>   _run_print
> _help
>     func(*a, **kw)
>   File "C:\Python27\lib\site-packages\scrapy\cmdline.py", line 149, in
>   _run_comm
> and
>     cmd.run(args, opts)
>   File "C:\Python27\lib\site-packages\scrapy\commands\crawl.py", line 47,
>   in run
>     crawler = self.crawler_process.create_crawler()
>   File "C:\Python27\lib\site-packages\scrapy\crawler.py", line 142, in
>   create_cr
> awler
>     self.crawlers[name] = Crawler(self.settings)
>   File "C:\Python27\lib\site-packages\scrapy\crawler.py", line 23, in
>   __init__
>     self.spiders = spman_cls.from_crawler(self)
>   File "C:\Python27\lib\site-packages\scrapy\spidermanager.py", line 35,
>   in from
> _crawler
>     sm = cls.from_settings(crawler.settings)
>   File "C:\Python27\lib\site-packages\scrapy\spidermanager.py", line 31,
>   in from
> _settings
>     return cls(settings.getlist('SPIDER_MODULES'))
>   File "C:\Python27\lib\site-packages\scrapy\spidermanager.py", line 22,
>   in __in
> it__
>     for module in walk_modules(name):
>   File "C:\Python27\lib\site-packages\scrapy\utils\misc.py", line 66, in
>   walk_mo
> dules
>     submod = __import__(fullpath, {}, {}, [''])
>   File "blog_crawl\spiders\dmoz_spider.py", line 1, in <module>
>     class DmozSpider(BaseSpider):
> NameError: name 'BaseSpider' is not defined
> 
> someone tells me why, pls

Assuming you are working your way through the tutorial at

http://doc.scrapy.org/en/latest/intro/tutorial.html#our-first-spider

you probably forgot to import the BaseSpider class with

from scrapy.spider import BaseSpider

as shown in the code snippet in the "Our first Spider" section of the 
tutorial.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How To Build Scrapy Environment YetToCome <wjw15129@gmail.com> - 2013-09-23 01:12 -0700
  Re: How To Build Scrapy Environment Peter Otten <__peter__@web.de> - 2013-09-23 10:37 +0200
    Re: How To Build Scrapy Environment YetToCome <wjw15129@gmail.com> - 2013-09-23 01:56 -0700
      Re: How To Build Scrapy Environment Peter Otten <__peter__@web.de> - 2013-09-23 11:25 +0200
        Re: How To Build Scrapy Environment YetToCome <wjw15129@gmail.com> - 2013-09-23 03:11 -0700
  Re: How To Build Scrapy Environment YetToCome <wjw15129@gmail.com> - 2013-09-23 01:55 -0700

csiph-web