1

I try running this script

from brownie import Token, accounts

def main():
return Token.deploy("Test Token", "TST", 18, 1e21, {'from': accounts[0]})

Then error message is an issue of finding brownie as import

    "resource": "/c:/Python/token/token/scripts/token.py",
    "owner": "_generated_diagnostic_collection_name_#0",
    "code": {
        "value": "reportMissingImports",
        "target": {
            "$mid": 1,
            "external": "https://github.com/microsoft/pylance-release/blob/main/DIAGNOSTIC_SEVERITY_RULES.md#diagnostic-severity-rules",
            "path": "/microsoft/pylance-release/blob/main/DIAGNOSTIC_SEVERITY_RULES.md",
            "scheme": "https",
            "authority": "github.com",
            "fragment": "diagnostic-severity-rules"
        }
    },
    "severity": 4,
    "message": "Import \"brownie\" could not be resolved",
    "source": "Pylance",
    "startLineNumber": 3,
    "startColumn": 6,
    "endLineNumber": 3,
    "endColumn": 13
1
  • Where is this error coming from ? Commented Feb 2, 2022 at 3:53

1 Answer 1

1

Not very much info provided, but I'll just shoot whatever comes to my mind.

  1. Do you have brownie installed? brownie --version

  2. Did you initialize the project using brownie init ?

  3. Do you have that Token.sol in contracts folder in your brownie project and has it been successfuly compiled using brownie compile before? You can check if it has been compiled in ./build/contracts/Token.json

8
  • Thanks for this information. brownie will not work. When I try pip install eth-brownie it fails with error message of: pip failed to build package: cytoolz
    – John
    Commented Feb 2, 2022 at 7:28
  • Try to follow this thread if it solves your issue: stackoverflow.com/questions/69875694/… Commented Feb 2, 2022 at 8:31
  • This fixed some the brownie issue.
    – John
    Commented Feb 4, 2022 at 10:37
  • please add your Token.sol code into your original question if its part of your problem Commented Feb 5, 2022 at 9:03
  • from brownie import Token, accounts def main(): return Token.deploy("Test Token", "TST", 18, 1e21, {'from': accounts[0]})
    – John
    Commented Feb 5, 2022 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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