简体   繁体   中英

Cannot import Items to Scrapy Spider [No module named] - Python

I have troubles importing Items.py from parent folder when using Scrapy framework. I've read that this is a fairly common issue but none of the proposed solution could work for me so far.

I've created a new project via scrapy startproject ime_projekta . CMD prompted me with:

ime_projekta.spiders.worldmaps

The error I am presented is No module named as indicated in CMD below. Any help would be great.

Thank you

码

There is no __init__.py file in the ime_projeckta folder. Either add one, or switch the line 3 of worldmaps.py to a relative import ( from ..items ).

Also note that you are trying to import Item from the wrong import path. It should be ime_projeckta.items .

我已经通过将蜘蛛放在与items.py相同的焊料中解决了这个问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM