我正在尝试使用 brownie 部署 helloWorld.sol。当我尝试运行brownie run scripts/deploy.py时出现以下错误。
正在终止本地 RPC 客户端...线程 Thread-5 中的异常:回溯(最后一次调用):文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connection .py”,第 175 行,在 _new_conn (self._dns_host, self.port), self.timeout, **extra_kw 文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages \urllib3\util\connection.py”,第 96 行,在 create_connection 中
引发错误文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\util\connection.py” ,第 86 行,在 create_connection
sock.connect(sa) ConnectionRefusedError: [WinError 10061] 无法建立连接,因为目标机器主动拒绝了它在处理上述异常的过程中,又出现了一个异常:
回溯(最后一次调用):文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connectionpool.py”,第 706 行,在 urlopen chunked=chunked,文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connectionpool.py”,第 394 行,在 _make_request conn.request(method, url, **httplib_request_kw) 文件中” C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connection.py",第 239 行,在请求 super(HTTPConnection, self).request(method, url, body= body, headers=headers) 文件“C:\Program Files\Python37\lib\http\client.py”,第 1229 行,在请求中 self._send_request(method, url, body, headers, encode_chunked) 文件“C:\Program Files\Python37\lib\http\client.py",第 1275 行,在 _send_request self.endheaders(body,encode_chunked=encode_chunked) 文件“C:\Program Files\Python37\lib\http\client.py”,第 1224 行,在 endheaders self._send_output(message_body, encode_chunked=encode_chunked) 文件“C:\Program Files\Python37\lib\ http\client.py”,第 1016 行,在 _send_output self.send(msg) 文件“C:\Program Files\Python37\lib\http\client.py”,第 956 行,在发送 self.connect() 文件“C :\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connection.py”,第 205 行,在 connect conn = self._new_conn() 文件“C:\Users\mmasn. local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connection.py”,第 187 行,在 _new_conn self 中,“无法建立新连接:%s”% e urllib3.exceptions.NewConnectionError: < urllib3.connection.HTTPConnection 对象位于 0x0000021DAA2A0F28>:无法建立新连接:[WinError 10061] 由于目标机器主动拒绝,无法建立连接
在处理上述异常的过程中,又出现了一个异常:
回溯(最后一次调用):文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\adapters.py”,第 449 行,在发送超时=超时文件中C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\connectionpool.py",第 756 行,在 urlopen 方法中,url,error=e,_pool=self,_stacktrace=sys .exc_info()[2] 文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\urllib3\util\retry.py”,第 574 行,增量提高 MaxRetryError(_pool , url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=8545): url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection)位于 0x0000021DAA2A0F28> 的对象:无法建立新连接:[WinError 10061] 由于目标机器主动拒绝,无法建立连接'))
在处理上述异常的过程中,又出现了一个异常:
Traceback(最近一次调用最后一次):文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc\ganache.py”,第 82 行,在 _request 响应中= web3.provider.make_request(method, args) # 类型:忽略文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\web3\providers\rpc.py”,行91,在 make_request **self.get_request_kwargs() 文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\web3_utils\request.py”,第 48 行,在 make_post_request 响应 = session.post(endpoint_uri, data=data, *args, **kwargs) # type: ignore File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\sessions. py",第 590 行,在 post 中返回 self.request('POST', url, data=data, json=json, **kwargs) File "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\sessions.py”,第 542 行,在请求 resp = self.send(prep, **send_kwargs) 文件“C:\Users\mmasn.local \pipx\venvs\eth-brownie\lib\site-packages\requests\sessions.py”,第 655 行,在发送 r = adapter.send(request, **kwargs) 文件“C:\Users\mmasn.local\ pipx\venvs\eth-brownie\lib\site-packages\requests\adapters.py",第 516 行,在发送中引发 ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1' , port=8545): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000021DAA2A0F28>: 无法建立新连接: [WinError 10061] 由于目标机器无法建立连接主动拒绝'))))))**send_kwargs) 文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\sessions.py”,第 655 行,在发送 r = adapter.send(request, * *kwargs) 文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\adapters.py”,第 516 行,发送引发 ConnectionError(e, request=request) 请求.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=8545): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000021DAA2A0F28>: 无法建立新连接: [WinError 10061] 无法建立连接,因为目标机器主动拒绝它'))**send_kwargs) 文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\sessions.py”,第 655 行,在发送 r = adapter.send(request, * *kwargs) 文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\adapters.py”,第 516 行,发送引发 ConnectionError(e, request=request) 请求.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=8545): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000021DAA2A0F28>: 无法建立新连接: [WinError 10061] 无法建立连接,因为目标机器主动拒绝它'))发送(请求,**kwargs)文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\adapters.py”,第 516 行,在发送中引发 ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=8545): Max retries exceeded with url: / (由 NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000021DAA2A0F28>: Failed建立新连接:[WinError 10061] 无法建立连接,因为目标机器主动拒绝它'))发送(请求,**kwargs)文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\requests\adapters.py”,第 516 行,在发送中引发 ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=8545): Max retries exceeded with url: / (由 NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000021DAA2A0F28>: Failed建立新连接:[WinError 10061] 无法建立连接,因为目标机器主动拒绝它'))/(由NewConnectionError引起('<urllib3.connection.HTTPConnection object at 0x0000021DAA2A0F28>: 无法建立新连接:[WinError 10061] 由于目标机器主动拒绝,无法建立连接'))/(由NewConnectionError引起('<urllib3.connection.HTTPConnection object at 0x0000021DAA2A0F28>: 无法建立新连接:[WinError 10061] 由于目标机器主动拒绝,无法建立连接'))
在处理上述异常的过程中,又出现了一个异常:
回溯(最后一次调用):文件“C:\Program Files\Python37\lib\threading.py”,第 917 行,在 _bootstrap_inner self.run() 文件“C:\Program Files\Python37\lib\threading.py ”,第 865 行,在运行 self._target(*self._args, **self._kwargs) 文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network \state.py”,第 332 行,在add_to_undo_buffer
self.sleep(0) 文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\state.py”中,第 375 行,处于睡眠状态。time_offset = int(rpc.Rpc().sleep(seconds)) 文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\ rpc_init.py”,第 45 行,在包装中返回 fn(*args, **kwargs) 文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc_ init .py”,第 166 行,在睡眠中返回 self.backend.sleep(seconds) 文件“C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc\ganache .py",第 91 行,在睡眠中返回 _request("evm_increaseTime", [seconds]) 文件 "C:\Users\mmasn.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\rpc \ganache.py",第 86 行,在 _request 中引发 RPCRequestError("Web3 is not connected.") brownie.exceptions.RPCRequestError: Web3 is not connected。
我的 deploy.py 代码如下。
from brownie import accounts, HelloWorld
def deployHelloWorld():
account = accounts[0]
helloWorldObject = HelloWorld.deploy({"from": account})
helloWorldObject.setName("Michael", {"from": account})
greeting = helloWorldObject.sayHello()
print(greeting)
def main():
deployHelloWorld()
能否请你帮忙?