Compiling a contract with `import_remappings` fails
- Dominant language
- Python
- Stars
- 195
- Forks
- 77
- PR merge metrics
- No merged PRs in 30d
Description
* `py-solc` Version: 2.1.0
* `solc` Version: 0.4.17
* Python Version: 3.5.2
* OS: Ubuntu 16.04, 4.4.0-104-generic
### What was wrong?
I tried to compile a contract, say like this one:
```
pragma solidity 0.4.17;
contract Blah {
uint public a;
function Blah(uint _a) public {
a = _a;
}
function getA() public view returns(uint) {
return a;
}
}
```
The `python` compilation code is as follows:
```
class Chain:
...
@classmethod
def compileContract(cls, filename):
with open(filename,'r') as f:
contract_source_code = f.read()
compiled_sol = compile_source(contract_source_code, import_remappings=['='])
return compiled_sol [':Blah']
...
```
Executing this function returns an error:
```
Traceback (most recent call last):
File "compile.py", line 71, in
compiled = Chain.compileContract(sys.argv[1])
File "compile.py", line 24, in compileContract
compiled_sol = compile_source(contract_source_code, import_remappings=["="])
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:
```
Notes:
* It fails whatever value I assign to `import_remapings`.
* Executing with `import_remappings` removed works fine (it's not needed in this example, but I have another case where I'm importing other contracts and I need to use it).
* Executing `solc --combined-json abi,asm,ast,bin,bin-runtime,clone-bin,devdoc,interface,opcodes,userdoc = blah.sol` directly from the command line works fine too (no errors, no warnings).
* I tried also running with `solc 0.4.19` in `docker` but problem persisted.
* All files I have in one directory and all commands were executed inside this directory.
#### Cute Animal Picture

Contributor guide
Assessment
This issue has not been assessed yet.