Closed Dcamy closed 2 years ago
Update: Found https://ethereum.stackexchange.com/questions/110405/having-a-problem-with-solc-x-version-solc-0-6-0-has-not-been-installed and made the changes updating 2 lines of code and ran npm install -g solc
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")
compile_sol = compile_standard(
{
"language": "solidity",
"source": {"SimpleStorage.sol": {"content": simple_storage_file}},
"settings": {
"outputSelection": {
"*": {"*": ["abi", "metadata", "evm.bytecode", "evm.sourceMap"]}
}
},
},
solc_version="0.6.0",
)
print(compile_sol)
I stared at this code for 2 days making no progress... and the I noticed "source" should be "sources" WITH A SECOND "s" at the end... fml... new issue... "solidity" should be "Solidity" with a capital "S"
from solcx import compile_standard, install_solc
with open("./SimpleStorage.sol", "r") as file:
simple_storage_file = file.read()
# Compile our Solidity
install_solc("v0.6.0")
compile_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(compile_sol)
Hi Patric, awesome course! Thank you so much for putting this out there!
I am stuck at 3:44:45 in the video, instead of getting the massive object I am getting a couple errors. Before I was getting a lot more errors along the way and have slowly whittled them down but this one has stopped me cold.
If anyone has any suggestions please let me know :)
This is the second time we run $ python deploy.py
Here is my error
$ python deploy.py INFO: Could not find files for the given pattern(s). Traceback (most recent call last): File "C:\Users\dbord\learn\learn-fcc\web3_py_simple_storage\deploy.py", line 8, in
compile_sol = compile_standard(
File "C:\Users\dbord\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\solcx\main.py", line 365, in compile_standard
raise ContractsNotFound(
solcx.exceptions.ContractsNotFound: Input JSON does not contain any sources
Here is my deploy.py code
Here is line 365 from solcx/main.py
Here is lines 331 - 411 for context of the file