简体   繁体   中英

can't import ethjsonrpc in python3.6 , ubuntu

when importing ethjsonrpc It throws an error as below:

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

This is an issue with ethjsonrpc as can be seen on the github issue page . The proposed fix is to just comment the line 103 in /usr/local/lib/python3.6/site-packages/ethereum/utils.py

Might be a good idea to switch to using this module with python2 instead in case more errors appear that are caused by version differences.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM