ethjsonrpc icon indicating copy to clipboard operation
ethjsonrpc copied to clipboard

Probably python3 issue: AttributeError: 'bytes' object has no attribute 'encode'

Open ivoras opened this issue 6 years ago • 7 comments

Traceback (most recent call last):
  File "./gethrpc.py", line 2, in <module>
    from ethjsonrpc import EthJsonRpc
  File "/usr/local/lib/python3.5/dist-packages/ethjsonrpc/__init__.py", line 1, in <module>
    from ethjsonrpc.client import (EthJsonRpc, ParityEthJsonRpc,
  File "/usr/local/lib/python3.5/dist-packages/ethjsonrpc/client.py", line 7, in <module>
    from ethereum import utils
  File "/usr/local/lib/python3.5/dist-packages/ethereum/utils.py", line 103, in <module>
    assert sha3('').encode('hex') == 'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'
AttributeError: 'bytes' object has no attribute 'encode'

ivoras avatar Aug 30 '17 10:08 ivoras

Yea, I fixed this locally, but I am a bit hesitant to make a PR because there are so many outstanding issues and PRs. Is this project still maintained?

lordi avatar Sep 10 '17 14:09 lordi

@lordi whether or not it's still maintained, everyone could benefit from a PR fixing this bug, so don't hesitate to share your version!

hiqua avatar Sep 14 '17 16:09 hiqua

Yes, I wish I could see the fix.

mjmj avatar Jan 24 '18 05:01 mjmj

hey @lordi if you send the PR to fix this issue, i can take it and merge it into my fork of this lib https://github.com/reiven/ethjsonrpc

Thanks!

reiven avatar Jan 24 '18 07:01 reiven

Have you guys seen this? https://github.com/suryanash/ethjsonrpc/commit/587959177a3378ce58505b777d9b87baf685909d

markusbkoch avatar Feb 06 '18 12:02 markusbkoch

I think just commment out "assert sha3('').encode('hex') == 'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'" is enough to avoid this error.

tkota0726 avatar Feb 08 '18 23:02 tkota0726

Change it to

assert sha3('').hex() == 'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'

wellttllew avatar Oct 17 '18 13:10 wellttllew