Web3.py版本: 4.2.1 Python: 3.5.2 OS: linux版本:1.8.0-不稳定
我运行geth时使用的是-shh标志和-rpcapi "admin、eth、net、web3、调试、shh“。
from web3 import Web3, HTTPProvider
web3 = Web3(HTTPProvider('http://localhost:8545'))
print ("web3 =", web3.version.api) #4.2.1
print(web3.shh) #error occurs当我试图运行上面的代码时,我有以下错误:
Traceback (most recent call last):
File "dd.py", line 11, in <module>
print(web3.shh)
AttributeError: 'Web3' object has no attribute 'shh'发布于 2018-07-14 13:31:29
您需要执行以下操作:
from web3.shh import Shh
Shh.attach(web3, "shh")
print(web3.shh)https://ethereum.stackexchange.com/questions/54370
复制相似问题