From Scraper_user.items Import UserItem ImportError: No Module Named Scraper_user.items
I am following this guide for scraping data from instagram: http://www.spataru.at/scraping-instagram-scrapy/ but I get this error: mona@pascal:~/computer_vision/instagram/instagra
Solution 1:
I changed these lines in spider.py:
3 from instagram.items import UserItem
4 from instagram.items import PostItem
And these lines in items.py:
1 import scrapy
2 from scrapy.item import Item, Field
3
4 class UserItem(Item):
5 username = Field()
6 follows_count = Field()
7 followed_by_count = Field()
8 is_verified = Field()
9 biography = Field()
10 external_link = Field()
11 full_name = Field()
12 posts_count = Field()
13 posts = Field()
14
15
16 class PostItem(Item):
17 code = Field()
18 likes = Field()
19 thumbnail = Field()
20 caption = Field()
21 hashtags = Field()
~
While it doesn't have the previous error, it has this new error which I didn't know how to fix:
mona@pascal:~/computer_vision/instagram/instagram$ scrapy crawl instagramspider
2017-03-01 17:24:03-0600 [scrapy] INFO: Scrapy 0.14.4 started (bot: instagram)
2017-03-01 17:24:04-0600 [scrapy] DEBUG: Enabled extensions: LogStats, TelnetConsole, CloseSpider, WebService, CoreStats, MemoryUsage, SpiderState
Traceback (most recent call last):
File "/usr/bin/scrapy", line 4, in <module>
execute()
File "/usr/lib/python2.7/dist-packages/scrapy/cmdline.py", line 132, in execute
_run_print_help(parser, _run_command, cmd, args, opts)
File "/usr/lib/python2.7/dist-packages/scrapy/cmdline.py", line 97, in _run_print_help
func(*a, **kw)
File "/usr/lib/python2.7/dist-packages/scrapy/cmdline.py", line 139, in _run_command
cmd.run(args, opts)
File "/usr/lib/python2.7/dist-packages/scrapy/commands/crawl.py", line 43, in run
spider = self.crawler.spiders.create(spname, **opts.spargs)
File "/usr/lib/python2.7/dist-packages/scrapy/command.py", line 34, in crawler
self._crawler.configure()
File "/usr/lib/python2.7/dist-packages/scrapy/crawler.py", line 36, in configure
self.spiders = spman_cls.from_crawler(self)
File "/usr/lib/python2.7/dist-packages/scrapy/spidermanager.py", line 37, in from_crawler
return cls.from_settings(crawler.settings)
File "/usr/lib/python2.7/dist-packages/scrapy/spidermanager.py", line 33, in from_settings
return cls(settings.getlist('SPIDER_MODULES'))
File "/usr/lib/python2.7/dist-packages/scrapy/spidermanager.py", line 23, in __init__
for module in walk_modules(name):
File "/usr/lib/python2.7/dist-packages/scrapy/utils/misc.py", line 65, in walk_modules
submod = __import__(fullpath, {}, {}, [''])
File "/home/mona/computer_vision/instagram/instagram/instagram/spiders/spider.py", line 7, in <module>
class InstagramSpider(scrapy.Spider):
AttributeError: 'module' object has no attribute 'Spider'
Post a Comment for "From Scraper_user.items Import UserItem ImportError: No Module Named Scraper_user.items"