-1

I'm trying to run this in the VS Code terminal for a Solidity Tutorial. Is there an error with my code, or could this be an issue with my environment?

Code:

from solcx import compile_standard, install_solc

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

    # Compile Our Solidity
    install_solc("0.6.0")
    compiled_sol = compile_standard(
        {
            "language": "solidity",
            "source": {"SimpleStorage.sol": {"content": simple_storage_file}},
            "settings": {
                "ouputSelection": {
                    "*": {"*": ["abi", "metadata", "evm.bytecode", "evm.sourceMap"]}
                }
            },
        },
        solc_version="0.6.0",
    )
print(compiled_sol)

Error:

  File "/Users/eddiebraddock/demos/web3_py_simple_storage/deploy.py", line 8, in <module>
    compiled_sol = compile_standard(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/solcx/main.py", line 365, in compile_standard
    raise ContractsNotFound(
solcx.exceptions.ContractsNotFound: Input JSON does not contain any sources
> command: ``
> return code: `None`
> stdout:
None
> stderr:
None
TylerH
  • 20,799
  • 66
  • 75
  • 101

2 Answers2

1

Input JSON does not contain any sources

That means sources property is not defined. Insead of "source" use sources:

 "sources": {"SimpleStorage.sol": {"content": simple_storage_file}},

Also, I am not sure if it will affect but language should be "Solidity" with capital letter

TylerH
  • 20,799
  • 66
  • 75
  • 101
Yilmaz
  • 35,338
  • 10
  • 157
  • 202
0

Use:

"sources"

The question missed the 's' at the end:

"source"
Alexander L. Hayes
  • 3,892
  • 4
  • 13
  • 34