I have set up PyCharm for remote debugging with the Python remote debug server configuration as described in PyCharm website on a Mac OS and a Linux (Debian 11.1) machine but I get a
socket.timeout: timed out
error.
In this configuration PyCharm emulates a server in the local machine where the PyCharm runs, and then a script running in a remote machine connects to that server. That server in turn tries to connect with the local machine.
It seems that there is a problem in the connection of the PyCharm server with the local machine, and possibly something with the port.
How can I check if the port is open (terminal commands or something else) or if there is something else blocking the connection?
This is the full error message:
Could not connect to <public ip address>: 12345
Traceback (most recent call last):
File "<path>/miniconda3/envs/env/lib/python3.9/site-packages/_pydevd_bundle/pydevd_comm.py", line 458, in start_client
s.connect((host, port))
socket.timeout: timed out
Traceback (most recent call last):
File "<path>/main.py", line 43, in <module>
pydevd_pycharm.settrace(<public ip address>, port=12345, stdoutToServer=True, stderrToServer=True)
File "<path>/miniconda3/envs/env/lib/python3.9/site-packages/pydevd.py", line 1689, in settrace
_locked_settrace(
File "<path>/miniconda3/envs/env/lib/python3.9/site-packages/pydevd.py", line 1745, in _locked_settrace
debugger.connect(host, port) # Note: connect can raise error.
File "<path>/miniconda3/envs/env/lib/python3.9/site-packages/pydevd.py", line 655, in connect
s = start_client(host, port)
File "<path>/miniconda3/envs/env/lib/python3.9/site-packages/_pydevd_bundle/pydevd_comm.py", line 458, in start_client
s.connect((host, port))
socket.timeout: timed out