When listening on all ports, it attempts to connect at
socket.gethostname(), which should be the same as the output of the
hostname command. This is the computer’s self-identified name on the network.
Usually, this name is connectable from the machine itself, but in some misconfigured networks, it can not be. The fix @yuvipanda proposed gives you a shortcut to ensure that the hostname points to localhost.
An alternate option is to specify
--ip=a.b.c.d where that is a specific ip (use 127.0.0.1 if you only want localhost for testing, or an external ip from
ifconfig if you want to be connectable from outside), rather than the default of ‘all interfaces’. Doing this avoids any potential hostname issues.