In Brownie I'm running a script which sends me this error "AttributeError: Module 'Users' Has No Method 'Main'. Do you have any suggestions on how I can fix this?

import os
from brownie import network, accounts, config, Hello

def main():
    my_account = accounts.add(os.getenv(config['wallets']['from_key']))
    hello = Hello.deploy({'from': my_account})

This is what I receive when I run the deploy.py script:

Brian Lee@MSI MINGW64 ~/Python39/brownie/New folder
$ brownie run scripts/deploy.py --network kovan
INFO: Could not find files for the given pattern(s).
Brownie v1.14.3 - Python development framework for Ethereum

NewFolderProject is the active project.
  File "c:\users\brian, line line, in in
    return_value, frame = run(
  File "c:\users\brian, line line, in in
    raise AttributeError(f"Module '{name}' has no method '{method_name}'")
AttributeError: Module 'Users.Brian Lee.Python39.brownie.New folder.scripts.deploy' has no method 'main'```
  • Do you have the whole stack trace? The error doesn't seems to be from the code in the question. – Ismael Mar 31 at 2:44
  • Hi @Ismael , thanks for the response. I just updated what occurs when I run the deploy.py script. Does that help? – Brian Lee Victory Mar 31 at 4:04
  • Is deploy.py inside script/ folder? Try running brownie run deploy.py --network kovan. – Ismael Mar 31 at 4:58
  • @Ismael , I double checked and yes deploy.py is saved under the script/folder. – Brian Lee Victory Mar 31 at 12:22

Your Answer

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

Browse other questions tagged or ask your own question.