ethjsonrpc
ethjsonrpc copied to clipboard
web3_sha3 not working under Python 2.7 on MacOS
Dear all,
i encountered some problem with the web3_sha3 rpc method on Mac OS with Python 2.7. Actually, line 150 in client.py does not reaturn a hex string starting with 0x. Since i assume that this is a Mac specific problem, otherwise other should have encountered it also, i would suggest to add something like:
if not data.startsWith('0x'): data = '0x' + data
Even with '0x' at the start of data
it still throws errors for me for any data that I give it. I've tried manually giving it something like 0x1234
. I saw in the code that it actually does data = str(data).encode('hex')
in the call, so I tried just putting in a string or a number, but nothing seems to be accepted by Geth. I continuously get
ethjsonrpc.exceptions.BadResponseError: {u'jsonrpc': u'2.0', u'id': 1, u'error': {u'message': u'invalid argument 0: json: cannot unmarshal hex string without 0x prefix into Go value of type hexutil.Bytes', u'code': -32602}}
I am also getting the same thing no matter what I do. MacOS, Python2.7...