steemit / steem-python

The official Python (3) library for the Steem Blockchain.
https://steem.io
MIT License
154 stars 100 forks source link

http_client.py - steembase.exceptions.RPCError: Internal Error #209

Closed puzzledbytheweb closed 6 years ago

puzzledbytheweb commented 6 years ago

Hello!

I am having this error: File "/usr/lib/python3.6/site-packages/steembase/http_client.py", line 263, in _return raise RPCError(error_message) steembase.exceptions.RPCError: Internal Error

It happens when creating an alias such as s = Steem(). I am a noob in programming and I am trying to do a project to help me learn faster and in a more meaningful way, I believe this problem has something to do with "http_client.py" but I am not sure if it is a "script" problem or something to do with the connection to the blockchain (if it happens when creating an alias).

This is temporary and seems that by rebooting the system it works, I am posting this just to report and to ask if I should be wary of malfunction when I deploy my little app, and if is "safe" to reboot the server in which my app should be hosted (maybe a dumb question :p).

I am working on Manjaro Linux (based on Arch Linux) with Kernel version 4.14.31.

Cheers!

Boontjie commented 6 years ago

Well you definitely dont have the appbase code yet. That simply means the node is having an issue. Steemit.com would also not work, try it now.

As an addendum there are issues if you do not parse the json result by error code. In the http_client.py the developer needs to do something like this.

if isinstance(result, dict) and 'error' in result: #sometimes the type is not a dict but an integer return

legacy (pre-appbase) nodes always return err code 1

                # deal with the error codes first before parsing the result

                internal_error = result['error']['code'] == -32603
                legacy = result['error']['code'] == 1

                if internal_error:
                    detail = result['error']['message']

                    detail = ":".join(detail.split("\n")[0:2])
                    raise RPCError('%s from %s (%s) in %s' % (
                        error, self.hostname, detail, name))

                if legacy:
                    detail = result['error']['message']
                    error = result['error']['data']['name']

                    detail = ":".join(detail.split("\n")[0:2])
                    if self._downgrade_curr_node():
                        logging.error('Downgrade-retry %s', self.hostname)
                        continue
cyon1c commented 6 years ago

@puzzledbytheweb Thank you for reaching out and filing an issue. Currently steem-python is undergoing a significant face lift alongside the release of HF 19.4 & AppBase. these issues are actively being worked on, that said, we will be releasing some big updates to PyPi soon, until then you can pull from master and install locally if you want to use these updates before they get to PyPi.