-3

I have problem connected to python. I want to compile solidity files using python. But getting error.

    import json


from solcx import compile_standard, install_solc



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



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

with open("compiled_code.json", "w") as file:
    json.dump(compiled_sol, file)

**first python where I get error and second solidity its' fine **

enter image description here

enter image description here

TylerH
  • 20,799
  • 66
  • 75
  • 101
irakli777
  • 41
  • 5
  • Welcome to SO. Please include errors as text and not images. – ewokx Apr 11 '22 at 07:46
  • As the error states, ```solc 0.9.0 has not been installed, Use solcx.install('0.9.0') to install```. Your second set of code doesn't use solc 0.9.0. – ewokx Apr 11 '22 at 07:48

1 Answers1

0

There isn't 0.9.0 solc version yet. Check official releases list and use available one. If you want to use the latest one, modify you code into:

solc_version="0.8.13",
kj-crypto
  • 483
  • 1
  • 7