当我在 Visual Studio 代码中编写编译代码时无法得到结果,我 运行 python deploy.py 并且它给了我错误。我必须在我的代码中编辑什么
I couldn't get results when I write compiled code in Visual Studio Code, I run python deploy.py and it gives me error. what I have to edit in my code
我刚开始编码,代码中似乎缺少一些东西,这是编译后的代码。它在 运行 python deploy.py 之后给我的错误信息
检查了很多次还是一样的错误
代码来自我正在学习的一课link:
https://github.com/PatrickAlphaC/web3_py_simple_storage
link中的代码:https://github.com/PatrickAlphaC/web3_py_simple_storage/blob/main/deploy.py
这是代码和错误信息,在此先感谢您:)
代码:
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)
错误:
INFO: Could not find files for the given pattern(s).
Traceback (most recent call last):
File "C:\Users\user\web3_py_simple_storage\deploy.py", line 8, in <module>
compiled_sol = compile_standard(
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\solcx\main.py", line 394, in compile_standard
raise SolcError(
solcx.exceptions.SolcError: Only "Solidity" or "Yul" is supported as a language.
command: `C:\Users\user\.solcx\solc-v0.6.0\solc.exe --standard-json`
return code: `0`
stdout:
{"errors":[{"component":"general","formattedMessage":"Only \"Solidity\" or \"Yul\" is supported as a language.","message":"Only \"Solidity\" or \"Yul\" is supported as a language.","severity":"error","type":"JSONError"}]}
将“语言”:“稳固性”更改为
“语言”:“团结”,
你有两个错别字
compiled_sol=compile_standard({
# not "solidity"
"language":"Solidity",
# not "simpleStorage"
"sources":{"SimpleStorage.sol":{"content":simple_storage_file}},
"settings":{
"outputSelection":{
"*":{
"*":["abi","metadata","evm.bytecode","evm.sourceMap"]
}
}
}
},
我刚开始编码,代码中似乎缺少一些东西,这是编译后的代码。它在 运行 python deploy.py 之后给我的错误信息 检查了很多次还是一样的错误
代码来自我正在学习的一课link: https://github.com/PatrickAlphaC/web3_py_simple_storage link中的代码:https://github.com/PatrickAlphaC/web3_py_simple_storage/blob/main/deploy.py
这是代码和错误信息,在此先感谢您:)
代码:
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)
错误:
INFO: Could not find files for the given pattern(s).
Traceback (most recent call last):
File "C:\Users\user\web3_py_simple_storage\deploy.py", line 8, in <module>
compiled_sol = compile_standard(
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\solcx\main.py", line 394, in compile_standard
raise SolcError(
solcx.exceptions.SolcError: Only "Solidity" or "Yul" is supported as a language.
command: `C:\Users\user\.solcx\solc-v0.6.0\solc.exe --standard-json`
return code: `0`
stdout:
{"errors":[{"component":"general","formattedMessage":"Only \"Solidity\" or \"Yul\" is supported as a language.","message":"Only \"Solidity\" or \"Yul\" is supported as a language.","severity":"error","type":"JSONError"}]}
将“语言”:“稳固性”更改为 “语言”:“团结”,
你有两个错别字
compiled_sol=compile_standard({
# not "solidity"
"language":"Solidity",
# not "simpleStorage"
"sources":{"SimpleStorage.sol":{"content":simple_storage_file}},
"settings":{
"outputSelection":{
"*":{
"*":["abi","metadata","evm.bytecode","evm.sourceMap"]
}
}
}
},