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

Lesson 4: Error with solcx #1903

Open
anasimov opened this issue Jul 28, 2024 · 2 comments
Open

Lesson 4: Error with solcx #1903

anasimov opened this issue Jul 28, 2024 · 2 comments

Comments

@anasimov
Copy link

Hi, I've just started lesson 4 and I am having an issue. Running on mac.

Code:

from solcx import compile_standard, install_solc

with open("./SimpleStorage.sol", "r") as file:
    simple_storage_file = file.read()

compiled_sol = compile_standard(
    {
        "language": "Solidity",
        "sources": {"SimpleStorage.sol": {"content": simple_storage_file}},
        "settings": {
            "outputSelection": {
                "*": {"*": ["abi", "metadata", "evm.bytecode", "evm.sourceMap"]}
            }
        },
    },
    solc_version="0.6.0",
)
print(compiled_sol)

And here is the error:

Traceback (most recent call last):
  File "/Users/Corey/demos/web3_py_simple_storage/deploy.py", line 6, in <module>
    compiled_sol = compile_standard(
                   ^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/solcx/main.py", line 347, in compile_standard
    solc_binary = get_executable(version=solc_version) if solc_binary is None else solc_binary
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/solcx/install.py", line 196, in get_executable
    raise SolcNotInstalled(
solcx.exceptions.SolcNotInstalled: solc 0.6.0 has not been installed. Use solcx.install_solc('0.6.0') to install.
@MarKiSS2000
Copy link

(What about this way?):

from solcx import compile_standard, install_solc

with open("./SimpleStorage.sol", "r") as file:
simple_storage_file = file.read()

install_solc("0.6.0")
compiled_sol = compile_standard(
{
"language": "Solidity",
"sources": {"SimpleStorage.sol": {"content": simple_storage_file}},
"settings": {
"outputSelection": {
"": {"": ["abi", "metadata", "evm.bytecode", "evm.sourceMap"]}
}
},
},
solc_version="0.6.0",
)
print(compiled_sol)

@MarKiSS2000
Copy link

MarKiSS2000 commented Sep 2, 2024

That is:
before the line
"compiled_sol = compile_standard("
you add the line
"install_solc("0.6.0")"

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