Screenshot of directory:


This is the code in my brownie.config.yaml file:

    - SafeMath
  - smartcontractkit/chainlink-brownie-contracts@1.0.2
  - OpenZeppelin/openzeppelin-contracts@3.4.0
      - '@chainlink=smartcontractkit/chainlink-brownie-contracts@1.0.2'
      - '@openzeppelin=OpenZeppelin/openzeppelin-contracts@3.4.0'
  from_key: ${PRIVATE_KEY}
  from_mnemonic: ${MNEMONIC} 

Code from deploy_advanced.py:

from brownie import AdvancedCollectible, accounts, network, config

def main():
    dev = accounts.add(config['wallets']['from_key'])

When I try to run 'brownie run scripts/advanced_collectible/deploy_advanced.py' I get the following error:

Running 'scripts/advanced_collectible/deploy_advanced.py::main'...
  File "brownie/_cli/run.py", line 49, in main
    return_value, frame = run(
  File "brownie/project/scripts.py", line 103, in run
    return_value = f_locals[method_name](*args, **kwargs)
  File "./scripts/advanced_collectible/deploy_advanced.py", line 4, in main
    dev = accounts.add(config['wallets']['from_key'])
KeyError: 'wallets'

Any advice on how to fix this error?

  • Looks like something is wrong with your config, as in, brownie isn't picking up your config file. Could you add a picture of what your directory looks like? – Patrick Collins May 6 at 12:58
  • Just updated it with my directory. I did happen to notice that my config file is called brownie.config.yaml vs brownie-config.yaml, not sure if that makes a difference. – rizonpoint May 6 at 20:23
  • It does. How did you get brownie.config.yaml? – Patrick Collins May 6 at 20:57
  • Great question that I wish I had the answer too 😅, I was wondering the same thing, must've been a typo on my end... It's now correctly pointing at the config, but i'm getting a "ParserError: while parsing a block mapping" message, is that due to a syntax error? – rizonpoint May 6 at 21:42
  • 1
    Sounds like a new question ;) – Patrick Collins May 6 at 21:43

changed brownie.config.yaml -> brownie-config.yaml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.