Blockchain

如何使用 eth-brownie python 執行 Chainlink 項目

  • December 21, 2021

我已經使用命令安裝了 eth-brownie

pip install eth-brownie

布朗尼安裝後。我已經將現有的布朗尼項目烘焙到一個新目錄中。

mkdir MyChainlinkProject
cd MyChainlinkProject/
brownie bake chainlink-mix
cd chainlink-mix

然後導出 infura.io 項目 id 和 kovan 網路私鑰

export WEB3_INFURA_PROJECT_ID='d1f95888fba84a42adasaa37803d4b5118ee'
export PRIVATE_KEY='0x5FE9bE1eC79dFE85b2748F6fEdasd60f811a8Ee997D9'

最後嘗試了這個命令

brownie run scripts/price_feed_scripts/deploy_price_consumer_v3.py --network kovan

返回錯誤

ChainlinkProject is the active project.
 File "brownie/_cli/run.py", line 50, in main
   args["<filename>"], method_name=args["<function>"] or "main", _include_frame=True
 File "brownie/project/scripts.py", line 53, in run
   module = _import_from_path(script)
 File "brownie/project/scripts.py", line 149, in _import_from_path
   _import_cache[import_str] = importlib.import_module(import_str)
 File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
   return _bootstrap._gcd_import(name[level:], package, level)
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
ModuleNotFoundError: No module named 'Users.casper'

所以任何人都有想法。謝謝

當我嘗試執行部署腳本時,我在 Brownie 中遇到了同樣的問題。

INFO: Could not find files for the given pattern(s).
Brownie v1.14.5 - Python development framework for Ethereum

ChainlinkProject is the active project.
 File "c:\users\brian, line line, in in
   return_value, frame = run(
 File "c:\users\brian, line line, in in
   module = _import_from_path(script)
 File "c:\users\brian, line line, in in
   _import_cache[import_str] = importlib.import_module(import_str)
 File "c:\users\brian, line line, in in
   return _bootstrap._gcd_import(name[level:], package, level)    
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
 File "<frozen, line line, in in
ModuleNotFoundError: No module named 'Users.Brian Lee.```

在主目錄之外執行您的項目。在我的情況下,我的主目錄 C:/Users/nyamgavaa.g 路徑 inporter 要求沒有帶有“.”的主目錄。這樣解決我的問題

引用自:https://ethereum.stackexchange.com/questions/96331