Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 获取错误“int”对象没有属性“\uuuu getitem\uuuu”_Python_Python 2.7_Scrapy - Fatal编程技术网

Python 获取错误“int”对象没有属性“\uuuu getitem\uuuu”

Python 获取错误“int”对象没有属性“\uuuu getitem\uuuu”,python,python-2.7,scrapy,Python,Python 2.7,Scrapy,我是python新手,但并没有得到运行核心文件的相同代码,但不能使用scrapy 'int' object has no attribute '__getitem__' File "/root/Desktop/crawler/webcrawler/webcrawler/spiders/regex.py", line 161, in colorz test = test + (p.coords[v] - clusters[i].center.coords[v]) ** 2

我是python新手,但并没有得到运行核心文件的相同代码,但不能使用scrapy

'int' object has no attribute '__getitem__'

  File "/root/Desktop/crawler/webcrawler/webcrawler/spiders/regex.py", line 161, in colorz
    test  = test + (p.coords[v] - clusters[i].center.coords[v]) ** 2    
exceptions.TypeError: 'int' object has no attribute '__getitem__'

p.coords或clusters或clusters[i].center.coords中的一个是整数,而不是序列。你能不能把相关的代码包括进来,这样我们就可以建议一个修复方案了?但核心文件运行的代码是不一样的。我不明白你在说什么。当我运行它时,我正在使用它,它工作正常,但当我将它添加到scrapy上时,我发现这个错误仍然令人困惑。你能分享你的代码吗?工作流程是什么?项目管道中的下载和后处理?