Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'inline_traces' thrown from gather_console_output function in cleos.py #184

Open
calebmcelroy opened this issue Mar 12, 2020 · 1 comment

Comments

@calebmcelroy
Copy link

My Environment:
OSX 10.14.6
eosio 2.0.3
eosio.cdt 1.7.0
Python 3.7.4
EOSFactory v3.4.0

Backstory:
The code used to produce this error can be found at https://github.com/flair-app/smart-contract. It was working when I was using EOSIO v1.8.0 & eosio.cdt v1.6.1, but just updated to eosio 2.0.3 & eosio.cdt 1.7.0 and it started producing this error.

======================================================================
ERROR: test_edit_profile_modifies_table_when_user_auth (__main__.ProfileActionsUnitTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_profile_actions.py", line 289, in test_edit_profile_modifies_table_when_user_auth
    permission=(HOST, Permission.ACTIVE)
  File "/Users/calebmcelroy/Dev/eosfactory/eosfactory/shell/account.py", line 321, in push_action
    is_verbose=False, json=True)
  File "/Users/calebmcelroy/Dev/eosfactory/eosfactory/core/cleos.py", line 712, in __init__
    self.console += gather_console_output(act)
  File "/Users/calebmcelroy/Dev/eosfactory/eosfactory/core/cleos.py", line 732, in gather_console_output
    for inline in act["inline_traces"]:
KeyError: 'inline_traces'

Reproducing the error:

git clone https://github.com/flair-app/smart-contract.git flair-smart-contract
cd flair-smart-contract/tests
python3 test_profile_actions.py ProfileActionsUnitTest.test_edit_profile_modifies_table_when_user_auth

My solution:
Modifying gather_console_output within core/cleos.py to check if that key exists seems to have fixed it. Though, I'm not sure what "inline_traces" actually contains, maybe output of inline actions? If that is the case, I'm not using inline actions.

def gather_console_output(act, padding=""):
    PADDING = "  "
    console = ""
    if len(act["console"]) > 0:
        console += padding + act["act"]["account"] + "@" + act["act"]["name"] + ":\n"
        console += padding + act["console"].replace("\n", "\n" + padding) + "\n"

    if 'inline_traces' in act and isinstance(act["inline_traces"], list):
        for inline in act["inline_traces"]:
            console += gather_console_output(inline, padding + PADDING)
    return (console + "\n").rstrip()

Thanks for this package it's been very useful!

@RAPHAELSTZ
Copy link

Well done and thanks, it helped me as well.
Do you know if the framework is still actively worked on, can you actually use it for production ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants