Error No module named items.

573 views
Skip to first unread message

Dc1981

unread,
Mar 30, 2014, 10:42:40 PM3/30/14
to scrapy...@googlegroups.com
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



Dc1981

unread,
Mar 30, 2014, 10:51:01 PM3/30/14
to scrapy...@googlegroups.com
Forgot to mention I did rename my spider file to sbiz.py but that did not work.

Gianluca Tomasino

unread,
Mar 31, 2014, 4:05:02 AM3/31/14
to scrapy...@googlegroups.com
Hi,

I think that the folder for the spiders have to be renamed to spiders (with s)

Gianluca

Dc1981

unread,
Mar 31, 2014, 6:50:35 PM3/31/14
to scrapy...@googlegroups.com
The spiders folder is already name spiders with an "s" at the end. I am using Ubuntu 13.10 not sure if this may have some thing to do with it.

Dc1981

unread,
Mar 31, 2014, 9:19:37 PM3/31/14
to scrapy...@googlegroups.com
Issue resolved

Jerry Wu

unread,
May 30, 2014, 9:55:10 AM5/30/14
to scrapy...@googlegroups.com, ct w
Hi, Dc1981,

Could you share any ideas of the reason why it happened? I am experiencing the same problem.

Thanks.

David Carlo

unread,
May 31, 2014, 4:09:07 AM5/31/14
to scrapy-users

Hey Jerry,

I saw your post the other day and I am sorry I am on vacation and dont have access to my laptop. I believe I what I did was recreated a new spider with a different name and just pasted the code and it worked. My issue was because I changed the spider name and it was giving me issues. If you want paste your code into the forum and I will look at it to see if I can find any errors.

--
You received this message because you are subscribed to a topic in the Google Groups "scrapy-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scrapy-users/wOc4BOiStwI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scrapy-users...@googlegroups.com.
To post to this group, send email to scrapy...@googlegroups.com.
Visit this group at http://groups.google.com/group/scrapy-users.
For more options, visit https://groups.google.com/d/optout.

Jerry Wu

unread,
Jun 2, 2014, 7:12:40 PM6/2/14
to scrapy...@googlegroups.com
Hi, David,

Finally I got the point. After I recreate the project and rename the spider, it works fine now.

Thanks for your tips.

David Carlo

unread,
Jun 2, 2014, 10:36:41 PM6/2/14
to scrapy-users

Cool I am glad it worked.

Reply all
Reply to author
Forward
0 new messages