我正在尝试加载我的scrapy但是,正如您所看到的,有一个错误:
File "rotina\spiders\rotina1.py", line 4, in <module>
from rotina.items import ImobiliariasItem
File "rotina\items.py", line 6
tipo = Field()
^
IndentationError: unexpected indent
我的items.py是:
from scrapy.item import Item, Field
categoria = Field()
tipo = Field()
qtd_quartos = Field()
qtd_banheiros = Field()
qtd_garagem = Field()
descricao = Field()
photo = Field()
我该怎么办?
答案 0 :(得分:2)
缺少一般项目声明。口译员不知道 应该分配字段的项目:
from scrapy.item import Item, Field
class MyItem(Item):
categoria = Field()
tipo = Field()
qtd_quartos = Field()
qtd_banheiros = Field()
qtd_garagem = Field()
descricao = Field()
photo = Field()
请查看文档中的此示例:http://doc.scrapy.org/en/latest/topics/items.html#declaring-items
为了直接缩进 - 您可以使用 tabnanny 等工具:http://pymotw.com/2/tabnanny/