ethereum / ethereum/py-solc

Cannot find import file

Open
#57 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
195
Forks
77
PR merge metrics
No merged PRs in 30d

Description

* `py-solc` Version: 3.1.0
* `solc` Version: 0.4.24
* Python Version: 3.7
* OS: osx

### What was wrong?
* full output of the error you received

> /usr/local/bin/python3.7 /Users/sam/work/tutorial/test/web3_test.py
> Traceback (most recent call last):
> File "/Users/sam/work/tutorial/test/web3_test.py", line 80, in
> compiled_sol = compile_source(contract_source_code, allow_paths=PROJECT_ROOT) # Compiled source code
> File "/usr/local/lib/python3.7/site-packages/solc/main.py", line 108, in compile_source
> stdoutdata, stderrdata, command, proc = solc_wrapper(**compiler_kwargs)
> File "/usr/local/lib/python3.7/site-packages/solc/utils/string.py", line 85, in inner
> return force_obj_to_text(fn(*args, **kwargs))
> File "/usr/local/lib/python3.7/site-packages/solc/wrapper.py", line 169, 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 --allow-paths /Users/sam/work/tutorial`
> > return code: `1`
> > stderr:
>
> > stdout:
> :2:1: Error: Source "interfaces/ISimpleStorage.sol" not found: File not found.
> import './interfaces/ISimpleStorage.sol';
> ^---------------------------------------^
>

* the code that caused the failure
There is an import in the solidity contract that I try to import another contract. But the program cannot find it.

in my python code:
```
contract_source_code = open('../contracts/storage/SimpleStorage.sol', 'r').read()
PROJECT_ROOT = os.path.dirname(os.path.dirname(__file__))
compiled_sol = compile_source(contract_source_code, allow_paths=PROJECT_ROOT) # Compiled source code

```
in my SimpleStorage.sol:
```
pragma solidity ^0.4.24;
import './interfaces/ISimpleStorage.sol';
```
Tree:
.
├── Migrations.sol
├── SimpleStorage.sol
├── storage
│   ├── SimpleStorage.sol
│   └── interfaces
│    └── ISimpleStorage.sol
├── token
│   ├── ERC20Token.sol
│   └── interfaces
│    └── IERC20Token.sol
└── utility
└── Utils.sol

#### Cute Animal Picture
![cc](https://user-images.githubusercontent.com/12135212/42868574-4235800c-8aa5-11e8-973d-66376c166763.jpg)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.