You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling the deprecated sha3 method as an instance (bound) method causes an error.
Please include any of the following that are applicable:
>>> import web3
>>> w3 = web3.Web3()
>>> foo='hello()'
>>> w3.keccak(text=foo)
HexBytes('0x19ff1d210e06a53ee50e5bad25fa509a6b00ed395695f7d9b82b68155d9e1065')
>>> web3.Web3.sha3(text=foo)
HexBytes('0x19ff1d210e06a53ee50e5bad25fa509a6b00ed395695f7d9b82b68155d9e1065')
>>> w3.sha3(text=foo)
__main__:1: DeprecationWarning: sha3 is deprecated in favor of keccak
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".\v5\lib\site-packages\web3\_utils\decorators.py", line 57, in wrapper
return to_wrap(*args, **kwargs)
File ".\v5\lib\site-packages\eth_utils\functional.py", line 46, in inner
return callback(fn(*args, **kwargs))
File ".\v5\lib\site-packages\web3\main.py", line 169, in sha3
return Web3.keccak(primitive, text, hexstr)
File ".\v5\lib\site-packages\eth_utils\functional.py", line 46, in inner
return callback(fn(*args, **kwargs))
File ".\v5\lib\site-packages\web3\main.py", line 183, in keccak
{'text': text, 'hexstr': hexstr}
TypeError: You called keccak with first arg <web3.main.Web3 object at 0x0150E5F0> and keywords {'text': 'hello()', 'hexstr': None}. You must call it with one of these approaches: keccak(text='txt'), keccak(hexstr='0x747874'), keccak(b'\x74\x78\x74'), or keccak(0x747874).
How can it be fixed?
I have a pull request to add @staticmethod to the definition to fix this.
After the pull request:
>>> w3.sha3(text=foo)
__main__:1: DeprecationWarning: sha3 is deprecated in favor of keccak
HexBytes('0x19ff1d210e06a53ee50e5bad25fa509a6b00ed395695f7d9b82b68155d9e1065')
The text was updated successfully, but these errors were encountered:
pip freeze
outputWhat was wrong?
Calling the deprecated sha3 method as an instance (bound) method causes an error.
Please include any of the following that are applicable:
How can it be fixed?
I have a pull request to add
@staticmethod
to the definition to fix this.After the pull request:
The text was updated successfully, but these errors were encountered: