solc.compile_source() Failed
See original GitHub issuepy-solc
Version: 2.1.0solc
Version: 0.4.21 (here is solcjs)- Python Version: 3.5.4
- OS: linux(ubuntu)
What was wrong?
Use compile_source(source) fail !!
My commands:
Install solc: npm install -g solc Install py-solc: pip3 install py-solc Use solc in python3: from solc import compile_source compile_source(‘pragma solidity ^0.4.0; contract A{ funcion A() public{}}’)
Details:
Traceback (most recent call last): File “<stdin>”, line 1, in <module> File “/usr/local/lib/python3.5/dist-packages/solc/main.py”, line 106, in compile_source stdoutdata, stderrdata, command, proc = solc_wrapper(**compiler_kwargs) File “/usr/local/lib/python3.5/dist-packages/solc/utils/string.py”, line 85, in inner return force_obj_to_text(fn(*args, **kwargs)) File “/usr/local/lib/python3.5/dist-packages/solc/wrapper.py”, line 165, in solc_wrapper stderr_data=stderrdata, solc.exceptions.SolcError: An error occurred during execution command:
solc --combined-json abi,asm,ast,bin,bin-runtime,clone-bin,devdoc,interface,opcodes,userdoc
return code:1
stderr:
stdout: Must provide a file
Cute Animal Picture
put a cute animal picture here.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Its possible that @ajax-2 hit another issue before hitting the syntax error. When I ran the example snippet I got:
I am using the apt packaged solc. Im wondering if the version of solc installed by the npm package is different than the regular solc binary. I also thought that the npm solc command was “solcjs”, which definitely does behave differently.
EDIT: @ajax-2 It does appear you are using solcjs instead of the solc binary. Did you link the solcjs executable to solc? I would remove that link and install the solc binary via apt:
Example showing solcjs error output when piping the source:
There is a typo in your solidity snippet. Missing the T in function. Should be: