0

Web3.py version: 4.2.1 Python: 3.5.2 OS: linux geth version: 1.8.0-unstable

I am running geth with --shh flag and --rpcapi "admin,eth,net,web3,debug,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

When I try to run following code above, I am having following error:

Traceback (most recent call last):
  File "dd.py", line 11, in <module>
    print(web3.shh)
AttributeError: 'Web3' object has no attribute 'shh'
1

You need to do the following:

from web3.shh import Shh
Shh.attach(web3, "shh")
print(web3.shh)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.