piston-cli icon indicating copy to clipboard operation
piston-cli copied to clipboard

'Nonetype' object is not subscriptable error

Open jtault opened this issue 9 years ago • 2 comments

Occasionally (every 10-20 votes or so) my bot fails with this error:

Traceback (most recent call last): File "./votingbot.py", line 113, in for c in steem.stream_comments(): File "/home/.local/lib/python3.4/site-packages/piston/steem.py", line 976, in stream_comments for c in self.rpc.stream("comment", _args, *_kwargs): File "/usr/local/lib/python3.4/dist-packages/steemapi/steemnoderpc.py", line 143, in stream for block in self.block_stream(_args, *_kwargs): File "/usr/local/lib/python3.4/dist-packages/steemapi/steemnoderpc.py", line 109, in block_stream head_block = props['last_irreversible_block_num'] TypeError: 'NoneType' object is not subscriptable

jtault avatar Oct 19 '16 01:10 jtault

This is weird .. the props variable should have been filled from the API node .. I guess this is rather a connectivity issuer ..

xeroc avatar Oct 21 '16 11:10 xeroc

It seems that my bot is able to handle lost connections successfully, so I'm not sure that is the problem. I'm not sure if it is related, but I also get these errors occasionally: Traceback (most recent call last): File "./votingbot.py", line 113, in for c in steem.stream_comments(): File "/home/.local/lib/python3.4/site-packages/piston/steem.py", line 977, in stream_comments yield Post(self, c) File "/home/.local/lib/python3.4/site-packages/piston/steem.py", line 100, in init post["_tags"] = meta.get("tags", []) AttributeError: 'str' object has no attribute 'get'

Also my voting function already catches broadcasting errors like so: def vote(c, weight): try: c.vote(weight, account) except BroadcastingError as e:
print("Vote failed...") print(str(e))

jtault avatar Oct 22 '16 12:10 jtault