#34537 (Bug) [Errno 8] nodename nor servname provided, or not known

+1 0

Created by Galois

Last modified

Python on Mac. Part of the program checks the system and returns data such as: IPAddress, local host name, hostname, computer name,. The program stopped working and raised an [Errno 8] ONLY after changing : computer name, hostname, local host name via the shell using: Sudo scutil –set Hostname etc.

def network_on(host_data,port_data,timeout_data):
host = host_data
port = port_data
timeout = timeout_data
import socket
socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect((host,port))
return True
except socket.error as ex:
return False

def get_sys_info(host):
import platform
import subprocess
import socket
subprocess_output = []
network_name = []
hostname = socket.gethostname()
IPAddress = socket.gethostbyname(hostname)
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
print(message_board(4),’\n’) # check
play_sound(message_board(84)) # connected
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
s.connect((message_board(95),message_board(98))) # host,port
Local_Router_IPAddr = s.getsockname()[0]
‘ ‘,message_board(42),platform.machine(),
‘ ‘,message_board(43),platform.system(),
‘ ‘,message_board(44),platform.platform(),’\n’)
print(message_board(45),hostname,’ ‘, message_board(47),\
Local_Router_IPAddr,’ ‘,message_board(46),IPAddress,’\n’)

Traceback (most recent call last):

IPAddress = socket.gethostbyname(hostname)
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

Leave a Reply