Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/279.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 属性错误:生成器对象没有属性';X';_Python - Fatal编程技术网

Python 属性错误:生成器对象没有属性';X';

Python 属性错误:生成器对象没有属性';X';,python,Python,我试图实现一个方法(Python3.4),其中传递两个对象。但我收到以下错误。 “AttributeError:生成器对象没有属性“X” 代码如下所示: def method_name(node1, node2): parsed = [] nextList = asyncio.Queue() iterations = 0 while not ((newNode.X == node2.X) and (newNode.Y ==

我试图实现一个方法(Python3.4),其中传递两个对象。但我收到以下错误。 “AttributeError:生成器对象没有属性“X”

代码如下所示:

    def method_name(node1, node2):
        parsed = []
        nextList = asyncio.Queue()
        iterations = 0
        while not ((newNode.X == node2.X) and (newNode.Y == node2.Y)):
            #code
我无法理解为什么会出现这个错误。在while循环中使用属性之前,我尝试打印属性的值。我能成功地把它打印出来。但是当我尝试在while循环中使用它时,我会遇到一些问题


提前感谢您的帮助。

在我们知道
node2
newNode
arenewNode指向node1之前,我无法理解为什么会出现此错误,我们也是如此。node1和node2是类的两个对象,它们的属性类似于X,Y,…请编辑您的帖子以包含一个。