Hey,
I'm a noob at this, so I'm probably doing something wrong.
I'm on OSX 10.11.1. geth v1.3.3 & pyethapp 1.0.18/darwin/py2.7.10.
I have tried to connect to a geth --rpc command running locally on my machine. The geth command seems to run fine, synchronised well and everything working without issue.
I wanted to start playing with the pyethapp library, and decided to check an account balance using the JSONRPCClient.
Running the command:
from pyethapp.rpc_client import JSONRPCClient
c = JSONRPCClient(port=8545)
c.balance('0xb794f5ea0ba39494ce839613fffba74279579268')
So after firing up a little debugging session it seems that the error is coming from this method.
The data is not passing the test at line 264 because it has a leading 0.
file pyethapp/jsonrpc.py:
258 def quantity_decoder(data):
259 """Decode `data` representing a quantity."""
260 if not is_string(data):
261 success = False
262 elif not data.startswith('0x'):
263 success = False # must start with 0x prefix
264 elif len(data) > 3 and data[2] == '0':
265 success = False # must not have leading zeros (except `0x0`)
266 else:
267 data = data[2:]
268 # ensure even length
269 if len(data) % 2 == 1:
270 data = '0' + data
271 try:
272 return int(data, 16)
273 except ValueError:
274 success = False
275 assert not success
276 raise BadRequestError('Invalid quantity encoding')
If I try to manually decode it using the command int(data, 16) line 272, it seems to run just fine, so I'm wondering if the test line 264 is useful in that context. Maybe this library isn't meant to be talking to a geth rpc server? After a quick look at the JSON RPC API, the example produced there seems to also have a leading 0. So is this a bug?
Hey, I'm a noob at this, so I'm probably doing something wrong. I'm on OSX 10.11.1. geth v1.3.3 & pyethapp 1.0.18/darwin/py2.7.10. I have tried to connect to a
geth --rpc
command running locally on my machine. The geth command seems to run fine, synchronised well and everything working without issue. I wanted to start playing with the pyethapp library, and decided to check an account balance using the JSONRPCClient.Running the command:
... raises the following error:
So after firing up a little debugging session it seems that the error is coming from this method. The data is not passing the test at line 264 because it has a leading
0
.file
pyethapp/jsonrpc.py
:If I try to manually decode it using the command
int(data, 16)
line 272, it seems to run just fine, so I'm wondering if the test line 264 is useful in that context. Maybe this library isn't meant to be talking to ageth rpc
server? After a quick look at the JSON RPC API, the example produced there seems to also have a leading 0. So is this a bug?Cheers, PE