Closed kharoof closed 6 years ago
Sounds like the exception you have has nothing to do with the fact that you streaming comments. Can you please post the exception you are getting?
Also, I would recommend not using stream_comments(). It automatically returns a Post object for each streamed post. This causes a lot of overhead as an extra API call is performed every single time. Better to do some filtering and call Post() when needed. stream_comments() is using the stream() function in Blockchain. So you could look at using that instead.
Experiencing similar error using stream_comments() also getting a error when using other Blockchain module actions. Tested on multiple networks.
>>> from steem import Steem
>>> s = Steem(nodes=['https://api.steemit.com'])
>>> for post in s.stream_comments():
... print(post.title)
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/kyle/Code/Django/env/local/lib/python3.6/site-packages/steem/steemd.py", line 132, in stream_comments
).stream("comment", *args, **kwargs):
File "/home/kyle/Code/Django/env/local/lib/python3.6/site-packages/steem/blockchain.py", line 177, in stream
for ops in self.stream_from(*args, **kwargs):
File "/home/kyle/Code/Django/env/local/lib/python3.6/site-packages/steem/blockchain.py", line 74, in stream_from
head_block = self.get_current_block_num()
File "/home/kyle/Code/Django/env/local/lib/python3.6/site-packages/steem/blockchain.py", line 42, in get_current_block_num
return self.info().get(self.mode)
File "/home/kyle/Code/Django/env/local/lib/python3.6/site-packages/steem/blockchain.py", line 34, in info
return self.steem.get_dynamic_global_properties()
File "/home/kyle/Code/Django/env/local/lib/python3.6/site-packages/steem/steemd.py", line 410, in get_dynamic_global_properties
return self.exec('get_dynamic_global_properties', api='database_api')
File "/home/kyle/Code/Django/env/local/lib/python3.6/site-packages/steembase/http_client.py", line 186, in exec
return_with_args=return_with_args)
File "/home/kyle/Code/Django/env/local/lib/python3.6/site-packages/steembase/http_client.py", line 206, in _return
raise RPCError(error_message)
steembase.exceptions.RPCError: Internal Error
seems api.steemit.com
is not so stable than former steemd.steemit.com
@cifer-lee Its a shame that they depreciated their stable node before properly testing the new one with all of their own official modules.
@KylePiira all right
It is the responsibility, for now, of client code to handle such exceptions and restart streaming.
PRs to make steem-python work better and handle this sort of retrying internally would likely get merged if they are up to our code standards, which unfortunately aren't well-documented yet but are approximately "use pep8 and pyflakes".
I have tried various attempts at streaming blockchain posts and issuing a command on pre defined events via a python script using the steem-python package (i.e. vote on posts or add a comment when certain conditions are met) but I keep running into the issue where the python script I am running crashes. This is really annoying and I have tried several implementations
My latest implementation is as follows
This code keeps having exceptions at the stage where I try to vote or comment which means I miss votes or miss comments. I have tried catching the error, waiting 5 seconds and trying again but it just fails again.
I am running python3.6 on a rasberry pi running raspbian and the steem package version is steem (0.18.103)