__init__() got an unexpected keyword argument 'shape'
时间: 2023-10-01 13:02:08 浏览: 86
This error message typically occurs when you try to instantiate an object of a class with an unexpected keyword argument. In this case, it seems that you are trying to pass a keyword argument called 'shape' to the __init__() method of a class, but this argument is not defined in the class.
To fix this error, you need to make sure that the class constructor (__init__() method) accepts the 'shape' keyword argument. You can do this by adding a parameter called 'shape' to the method signature, like this:
```
class MyClass:
def __init__(self, shape):
# constructor code here
```
Then, when you create an instance of the class, you can pass the 'shape' argument as a keyword argument, like this:
```
my_obj = MyClass(shape='square')
```
Make sure that the class definition and the instantiation code match the expected parameter names and types.
阅读全文