Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scrapy genspider creates import DirbotItem but I get ImportError: cannot import name DirbotItem #1

Merged
merged 1 commit into from
Jun 8, 2012

Conversation

stav
Copy link
Contributor

@stav stav commented Jun 7, 2012

After running:

stav@maia:/srv/scrapy/dirbot-fork$ scrapy genspider test example.com
Created spider 'test' using template 'crawl' in module:
  dirbot.spiders.test

I get an error trying to compile the spider:

stav@maia:/srv/scrapy/dirbot$ scrapy shell
2012-06-07 18:06:12-0500 [scrapy] INFO: Scrapy 0.15.1 started (bot: dirbot)
2012-06-07 18:06:12-0500 [scrapy] DEBUG: Enabled extensions: TelnetConsole, CloseSpider, WebService, CoreStats, SpiderState
Traceback (most recent call last):
  File "/usr/local/bin/scrapy", line 5, in <module>
    pkg_resources.run_script('Scrapy==0.15.1', 'scrapy')
  File "/usr/local/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 489, in run_script
  File "/usr/local/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 1207, in run_script
  File "/usr/local/lib/python2.6/site-packages/Scrapy-0.15.1-py2.6.egg/EGG-INFO/scripts/scrapy", line 4, in <module>
    execute()
  File "/usr/local/lib/python2.6/site-packages/Scrapy-0.15.1-py2.6.egg/scrapy/cmdline.py", line 110, in execute
    _run_print_help(parser, _run_command, cmd, args, opts)
  File "/usr/local/lib/python2.6/site-packages/Scrapy-0.15.1-py2.6.egg/scrapy/cmdline.py", line 76, in _run_print_help
    func(*a, **kw)
  File "/usr/local/lib/python2.6/site-packages/Scrapy-0.15.1-py2.6.egg/scrapy/cmdline.py", line 117, in _run_command
    cmd.run(args, opts)
  File "/usr/local/lib/python2.6/site-packages/Scrapy-0.15.1-py2.6.egg/scrapy/commands/shell.py", line 38, in run
    shell = Shell(self.crawler, update_vars=self.update_vars, inthread=True, \
  File "/usr/local/lib/python2.6/site-packages/Scrapy-0.15.1-py2.6.egg/scrapy/command.py", line 32, in crawler
    self._crawler.configure()
  File "/usr/local/lib/python2.6/site-packages/Scrapy-0.15.1-py2.6.egg/scrapy/crawler.py", line 36, in configure
    self.spiders = spman_cls.from_crawler(self)
  File "/usr/local/lib/python2.6/site-packages/Scrapy-0.15.1-py2.6.egg/scrapy/spidermanager.py", line 37, in from_crawler
    return cls.from_settings(crawler.settings)
  File "/usr/local/lib/python2.6/site-packages/Scrapy-0.15.1-py2.6.egg/scrapy/spidermanager.py", line 33, in from_settings
    return cls(settings.getlist('SPIDER_MODULES'))
  File "/usr/local/lib/python2.6/site-packages/Scrapy-0.15.1-py2.6.egg/scrapy/spidermanager.py", line 23, in __init__
    for module in walk_modules(name):
  File "/usr/local/lib/python2.6/site-packages/Scrapy-0.15.1-py2.6.egg/scrapy/utils/misc.py", line 65, in walk_modules
    submod = __import__(fullpath, {}, {}, [''])
  File "/srv/scrapy/dirbot/dirbot/spiders/test.py", line 4, in <module>
    from dirbot.items import DirbotItem
ImportError: cannot import name DirbotItem

So I added DirbotItem to items.py and PEP'd up a couple other files as well.

pablohoffman added a commit that referenced this pull request Jun 8, 2012
`scrapy genspider` creates `import DirbotItem` but I get ImportError: cannot import name DirbotItem
@pablohoffman pablohoffman merged commit e07c002 into scrapy:master Jun 8, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants