I have the following folder structure
/project
/scrape
item.py
/spiders
myscraper.py
inside the file item.py i have a declaration for
class MyItem(Item):
with a lot more code in it.
I am trying to run scrapy as
scrapy crawl myscraper
from the folder /project, but I keep getting the error.
exceptions.NameError: global name 'MyItem' is not defined
Would anyone know what I need to do different to make sure scrapy sees my item.py file?
Thanks
I can’t be sure because I can see so few of your code, but it looks like you have a circular import.
Check if you are not importing something from one file and vice-versa, rearrange your code so that it doesn’t happen anymore.