首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将'Only“"Solidity”或"Yul“作为来自py-solc-x的语言错误进行修复?

如何将'Only“"Solidity”或"Yul“作为来自py-solc-x的语言错误进行修复?
EN

Ethereum用户
提问于 2022-01-04 13:36:34
回答 1查看 277关注 0票数 1

这是我在运行这段代码后遇到的错误

代码语言:javascript
复制
from solcx import compile_standard, install_solc

install_solc("0.6.0")

#from my crowdFund.sol file i call the whole file
with open("./CrowdFund.sol", "r") as file:
    FromOld = file.read()


#compile our solidity


compiled_Sol = compile_standard(
    {
        "language": "solidity",
        "sources": {"CrowdFund.sol": {"content":FromOld}},
        "settings": {
            "outputSelection": {
                "*": {"*":["abi", "metadata", "evm.bytecode", "evm.sourceMap"]}
            }
        },
    },
    solc_version="0.6.0",
)
print("compiled_Sol")
代码语言:javascript
复制
----------------------------------------------------------------------------

INFO: Could not find files for the given pattern(s).
Traceback (most recent call last):
  File "C:\Users\SpiderHunter\Desktop\Solidity_Pro\deploy.py", line 13, in <module>
    compiled_Sol = compile_standard(
  File "C:\Users\SpiderHunter\AppData\Local\Programs\Python\Python39\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\SpiderHunter\.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"}]}

> stderr:
EN

回答 1

Ethereum用户

发布于 2022-01-04 13:55:18

对于language,您使用了小写的solidity,但它必须是精确的Solidity

这里是官方文档:https://docs.soliditylang.org/en/v0.8.11/using-the-compiler.html#input-description

这里是输入的js示例:https://github.com/gnosis/safe-contracts/blob/186a21a74b327f17fc41217a927dea7064f74604/test/utils/setup.ts#L99

票数 2
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/117958

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档