Web3.py

布朗尼問題

  • February 16, 2022

當我執行 brownie 時,我收到以下錯誤消息。

root@DESKTOP-MIQQV4H:/mnt/c/users/user/documents/blockchain/brownie_simple_storage# nvm install 16.13.2
v16.13.2 is already installed.
Now using node v16.13.2 (npm v8.1.2)
root@DESKTOP-MIQQV4H:/mnt/c/users/user/documents/blockchain/brownie_simple_storage# node --version
v16.13.2
root@DESKTOP-MIQQV4H:/mnt/c/users/user/documents/blockchain/brownie_simple_storage# brownie run scripts/deploy.py
Brownie v1.17.2 - Python development framework for Ethereum

BrownieSimpleStorageProject is the active project.

Launching 'ganache-cli --port 8545 --gasLimit 12000000 --accounts 10 --hardfork istanbul --mnemonic brownie'...
 File "brownie/_cli/run.py", line 50, in main
   return_value, frame = run(
 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 "/usr/lib/python3.8/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
ModuleNotFoundError: No module named 'mnt.c.Users.user'
Terminating local RPC client...

**問題解決了

現在我遇到以下情況:

root@DESKTOP-MIQQV4H:/mnt/c/users/user/documents/Blockchain/brownie_fund_me# brownie run scripts/deploy.py
Brownie v1.17.2 - Python development framework for Ethereum

BrownieFundMeProject is the active project.
 File "brownie/_cli/__main__.py", line 64, in main
   importlib.import_module(f"brownie._cli.{cmd}").main()
 File "brownie/_cli/run.py", line 44, in main
   network.connect(CONFIG.argv["network"])
 File "brownie/network/main.py", line 48, in connect
   rpc.attach(host)
 File "brownie/network/rpc/__init__.py", line 113, in attach
   pid = self._find_rpc_process_pid(resolved_addr)
 File "brownie/network/rpc/__init__.py", line 194, in _find_rpc_process_pid
   return self._get_pid_from_net_connections(laddr)
 File "brownie/network/rpc/__init__.py", line 234, in _get_pid_from_net_connections
   raise ProcessLookupError(
ProcessLookupError: Could not attach to RPC process by querying 'proc.net_connections()'

我試圖像有人建議的那樣在防火牆中為埠 8545 設置一個例外。但無濟於事。

這裡出了什麼問題?

對於後面的問題,我猜您使用的是 Windows WSL 中的 brownie。

我有類似的問題並在幾個月前送出了 PR

https://github.com/eth-brownie/brownie/pull/1303

也許這可以幫助你。

當 brownie 初始化時,它會列印到控制台文件路徑數據,例如:/mnt/c/users/..

請注意,在錯誤消息中使用者中的大寫 U,然而,控制台報告的使用者文件夾都是小寫的:

Error message No module named 'mnt.c.Users.user'

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