Hi, I think that the folder for the spiders have to be renamed to spiders (with s)
Gianluca Il giorno lunedì 31 marzo 2014 04:51:01 UTC+2, Dc1981 ha scritto: > > Forgot to mention I did rename my spider file to sbiz.py but that did not > work. > > On Sunday, March 30, 2014 10:42:40 PM UTC-4, Dc1981 wrote: >> >> Hello I am creating a scraper to pull info from sunbiz and I am getting >> the following error: *from sunbiz.items import SunbizItem ImportError: >> No module named items*. The items file does exist, its in the folder >> that I created for this project for example sunbiz/items.py. I have >> configured the file by creating objects. Below I have pasted my code. Not >> sure what I am doing wrong so any advice will be greatly appreciated. >> >> *items.py file* >> from scrapy.item import Item, Field >> >> class SunbizItem(Item): >> # define the fields for your item here like: >> # name = Field() >> company = Field() >> status = Field() >> pass >> >> *spider/sunbiz.py* >> from scrapy.spider import Spider >> from scrapy.selector import Selector >> from sunbiz.items import SunbizItem >> >> class SunbizSpider(Spider): >> name = "Sunbiz" >> allowed_domains = ['sunbiz.org'] >> start_urls = [ >> ' >> http://search.sunbiz.org/Inquiry/CorporationSearch/SearchResults/EntityName/a/Page1 >> ' >> ] >> >> >> def parse(self, response): >> sel = Selector(response) >> sites = sel.xpath('//tbody/tr') >> items = [] >> for site in sites: >> item = SunbizItem() >> item["company"] = sel.xpath('//td[1]/a/text()').extract() >> item["status"] = sel.xpath('//td[3]/text()').extract() >> items.append(item) >> return items >> >> >> >> -- You received this message because you are subscribed to the Google Groups "scrapy-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/scrapy-users. For more options, visit https://groups.google.com/d/optout.
