'Brownie doesn't import the downloaded files
I have checked various questions regarding Brownie compile. But mine is a little unique. I have some Japanese font which is not read properly by the Brownie compiler. enter image description here
PS C:\Bharath\src\crypto\python\demos\boss\brow2\brownie_fund_me> brownie compile
INFO: Could not find files for the given pattern(s).
Brownie v1.17.2 - Python development framework for Ethereum
865kiB [00:01, 509kiB/s]
WARNING: Unable to compile smartcontractkit/[email protected] due to a UnicodeDecodeError - you may still be able to import sources from the package, but will be unable to load the package directly.
Compiling contracts...
Solc version: 0.6.12
Optimizer: Enabled Runs: 200
EVM Version: Istanbul
CompilerError: solc returned the following errors:
contracts/FundMe.sol:5:1: ParserError: Source "C:/Users/チEôェバラト!EharathTV��.brownie/packages/smartcontractkit/[email protected]/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol" not found: File outside of allowed directories.
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
^--------------------------------------------------------------------------^
contracts/FundMe.sol:6:1: ParserError: Source "C:/Users/チEôェバラト!EharathTV��.brownie/packages/smartcontractkit/[email protected]/contracts/src/v0.6/vendor/SafeMathChainlink.sol" not found: File outside of allowed directories.
import "@chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol";
^------------------------------------------------------------------^
contracts/test/MockV3Aggregator.sol:4:1: ParserError: Source "C:/Users/チEôェバラト!EharathTV��.brownie/packages/smartcontractkit/[email protected]/contracts/src/v0.6/interfaces/AggregatorV2V3Interface.sol" not found: File outside of allowed directories.
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV2V3Interface.sol";
Solution 1:[1]
Did you add them into your brownie-config.yaml?
It should look like this:
dependencies:
- OpenZeppelin/[email protected]
- smartcontractkit/[email protected]
compiler:
solc:
remappings:
- '@openzeppelin=OpenZeppelin/[email protected]'
- '@chainlink=smartcontractkit/chainlink-brownie [email protected]'
dotenv: .env
wallets:
from_key: ${PRIVATE_KEY}
Solution 2:[2]
I was facing the same issue then i changed solidity version in FundMe.sol file to pragma solidity ^0.6.6; I hope this will help you as well.
Solution 3:[3]
There could be a possibility of typo in brownie-config.yml file. I had the same issue and I found that it was due to a misspelling.
dependencies:
# the pattern is <organization/repo>@<version>
- smartcontractkit/[email protected]
compiler:
solc:
remappings:
- '@chainlink=smartcontractkit/[email protected]'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Kuly14 |
| Solution 2 | user17057747 |
| Solution 3 | Ameet Mund |
