I am running Ubuntu 20.04 on Windows 10 using WSL2.
I am trying to connect to bitcoin testnet server on my machine 127.0.0.1 through Python
The python scripts work fine on Pycharm, Command Prompt and Powershell, and up until very recently worked fine in Ubuntu when i was runnign it on WSL1
Having switched to WSL2 for Ubuntu I receive the following error despite at the same working in CMD, PS, and Pycharm. Seems there's something blocking on the Ubuntu side. How do I fix this? Disabling Windows Fast Start didn't solve this issue.
Traceback (most recent call last):
File "/home/lalexk/mpcs56600-work/Lab4/Lab4.py", line 308, in <module>
run_lab_4()
File "/home/lalexk/mpcs56600-work/Lab4/Lab4.py", line 236, in run_lab_4
block_info = connect_rpc(which_port, rpc_username, rpc_password, block_to_get)
File "/home/lalexk/mpcs56600-work/Lab4/Lab4.py", line 41, in connect_rpc
return rpc_connection.getblock(block_hash)
File "/home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.9.6/lib/python3.9/site-packages/bitcoinrpc/authproxy.py", line 132, in __call__
self.__conn.request('POST', self.__url.path, postdata,
File "/home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.9.6/lib/python3.9/http/client.py", line 1257, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.9.6/lib/python3.9/http/client.py", line 1303, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.9.6/lib/python3.9/http/client.py", line 1252, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.9.6/lib/python3.9/http/client.py", line 1012, in _send_output
self.send(msg)
File "/home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.9.6/lib/python3.9/http/client.py", line 952, in send
self.connect()
File "/home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.9.6/lib/python3.9/http/client.py", line 923, in connect
self.sock = self._create_connection(
File "/home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.9.6/lib/python3.9/socket.py", line 843, in create_connection
raise err
File "/home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.9.6/lib/python3.9/socket.py", line 831, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused