When I run the following command to get the host ip:
socket.gethostbyname(socket.gethostname())
I am getting the following error on MAC terminal:
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
Any idea what the problem could be?
socket.gethostname() does return the correct hostname.
Try to open as root /etc/hosts file, and add a line like the following
# IP ADDR HOSTNAME
192.168.1.1 your_desired_hostname
and the name should resolve.
Obviously substitute 192.168.1.1 with your ip address.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With