I m trying to print out the variable (compiled_sol
) as you will see in the code below of the python file named deploy.py
so I can deploy my smart contract, but I keep running at this error
*****INFO: Could not find files for the given pattern(s).
Traceback (most recent call last):
File "C:\Users\houde\Desktop\Blockchain\solidity_projects\web3_py_simple_storage\deploy.py", line 8, in <module>
compiled_sol = compile_standard(
File "C:\Users\houde\AppData\Roaming\Python\Python39\site-packages\solcx\main.py", line 368, in compile_standard
solc_binary = get_executable(solc_version)
File "C:\Users\houde\AppData\Roaming\Python\Python39\site-packages\solcx\install.py", line 194, 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. ******
I did install the solc-x
via this command pip install py-solc-x
so I can compile the contracts but I don't know how to upgrade the version or what to do in this case, I will leave the code for you guys down below, and thank you a lot.
from solcx import compile_standard
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")
note:"the solc version 0.6.0 I m using it for the contract"