JetJet13 / NuExplorerOS

Nu Network Block Explorer
10 stars 15 forks source link

Altcoin based nubit got error with NuParserv007.py #5

Open followtheart opened 8 years ago

followtheart commented 8 years ago

Get error when running NuParserv007:

/home/NuExplorerOS# python pythonparser/NuParserv007.py
Traceback (most recent call last):
  File "pythonparser/NuParserv007.py", line 32, in <module>
    BlockCount =  getInfo["blocks"]
TypeError: 'NoneType' object has no attribute '__getitem__'

I do some test:

Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from bitcoinrpc.authproxy import AuthServiceProxy
>>> import logging
>>> logging.basicConfig()
>>> logging.getLogger("BitcoinRPC").setLevel(logging.DEBUG)
>>> ac = AuthServiceProxy('http://user:pass@127.0.0.1:14001')
>>> ac.getinfo()
DEBUG:BitcoinRPC:-1-> getinfo []
DEBUG:BitcoinRPC:<-1- {"connections": 1, "errors": "", "blocks": 400, "keypoolsize": 101, "moneysupply": 80000000.0, "walletunit": "S", "ip": "xx.xx.4.190", "keypoololdest": 1459236028, "stake": 0.0, "paytxfee": 1.0, "walletversion": 1, "difficulty": 0.00024414, "testnet": false, "version": "v2.1.0.0-unk-beta", "parked": 0.0, "protocolversion": 50000, "timeoffset": 0, "newmint": 0.0, "balance": 0.0, "proxy": ""}
>>> acinfo = ac.getinfo()
DEBUG:BitcoinRPC:-2-> getinfo []
DEBUG:BitcoinRPC:<-2- {"connections": 1, "errors": "", "blocks": 400, "keypoolsize": 101, "moneysupply": 80000000.0, "walletunit": "S", "ip": "xx.xx.4.190", "keypoololdest": 1459236028, "stake": 0.0, "paytxfee": 1.0, "walletversion": 1, "difficulty": 0.00024414, "testnet": false, "version": "v2.1.0.0-unk-beta", "parked": 0.0, "protocolversion": 50000, "timeoffset": 0, "newmint": 0.0, "balance": 0.0, "proxy": ""}
>>> print(acinfo)
None
>>>

Ask for advices :sos:

JetJet13 commented 8 years ago

Hey @followtheart thanks for showing interest in NuExplorer. In terms of your issue, TypeError: 'NoneType' object has no attribute '__getitem__' means that the variable getInfo is None, and so you can't return a value from a None variable. So one solution is to simply remove the variable getInfo, and replace it with BlockCount = access.getinfo()["blocks"]

Let me know if it works. Cheers.