smartcontractkit / full-blockchain-solidity-course-py

Ultimate Solidity, Blockchain, and Smart Contract - Beginner to Expert Full Course | Python Edition
MIT License
10.81k stars 2.91k forks source link

cannot import Lottery contract from Brownie in python script #611

Open pokke1 opened 2 years ago

pokke1 commented 2 years ago

I have following lesson 6 of the course. I have the Lottery.sol contract correctly compiling but if I try to run this python script:

from brownie import Lottery

def main():
    print("done")

I get this error: ImportError: cannot import name 'Lottery' from 'brownie' (C:\Program Files\Python39\lib\site-packages\brownie\__init__.py)

Any suggestion?

pokke1 commented 2 years ago

And this is the file I have at (C:\Program Files\Python39\lib\site-packages\brownie__init__.py), also if I try to import other packages such as config or network it works fine

#!/usr/bin/python3

"""
isort:skip_file
"""
from brownie.project import compile_source, run
from brownie._config import CONFIG as _CONFIG
from brownie.convert import Fixed, Wei
from brownie.network import accounts, alert, chain, history, rpc, web3
from brownie.network.contract import Contract  # NOQA: F401
from brownie.network import multicall as _multicall

ETH_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"

config = _CONFIG.settings
multicall = _multicall.Multicall()

__all__ = [
    "Contract",
    "ETH_ADDRESS",
    "ZERO_ADDRESS",
    "accounts",  # accounts is an Accounts singleton
    "alert",
    "chain",
    "history",  # history is a TxHistory singleton
    "multicall",
    "network",
    "rpc",  # rpc is a Rpc singleton
    "web3",  # web3 is a Web3 instance
    "project",
    "compile_source",
    "run",
    "Fixed",
    "Wei",
    "config",
]
mr-ziash commented 2 years ago

hey did you solve this issue?