python sintax problem for solidity compilator

62 views Asked by At

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

1

There are 1 answers

0
kj-crypto On BEST ANSWER

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",