ethjsonrpc icon indicating copy to clipboard operation
ethjsonrpc copied to clipboard

web3_sha3 not working under Python 2.7 on MacOS

Open jansenmarc opened this issue 7 years ago • 2 comments

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

jansenmarc avatar Jul 06 '17 13:07 jansenmarc

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}}

srya-b avatar Oct 02 '17 19:10 srya-b

I am also getting the same thing no matter what I do. MacOS, Python2.7...

fjblau avatar Nov 12 '17 08:11 fjblau