"属性"对象不可调用



所以我正在连接到一个合约,这似乎工作正常,我正在尝试使用这个类:web3.personal.personal来自 https://web3py.readthedocs.io/en/stable/web3.personal.html,我似乎不明白我错了什么...... 当我打印(web3.personal.Personal(时,我返回了一个类对象,但我似乎无法使用与此类关联的任何函数,说我缺少"self"参数

contract_abi = my_abi
w3 = Web3(HTTPProvider(myurl))
myContract = w3.eth.contract(address ,abi)
ref = ref = web3.personal.Personal('web3')
print(ref) #this works   
print(ref.newAccount(password='the-passphrase')) #This crashes
TypeError: newAccount() missing 1 required positional argument: 'self'
TypeError: 'property' object is not callable

似乎web3.personal.Personal是一个类,所以为了创建一个对象,你需要说ref = web3.personal.Personal()

请注意,课程通常(但并非总是(用大写字母书写。

最新更新