所以我已经连接到合同,这似乎工作正常,我试图使用这个类:来自https://web3py.readthedocs.io/en/stable/web3.personal.html的web3.personal.Personal我似乎不明白我错了什么...当我打印(web3) .personal.Personal)给了我一个类对象,但我似乎无法使用与这个类相关的任何函数,说我缺少“自我”论证
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()
请注意,课程通常(但不总是)用大写字母书写。