try:
s.connect((host, port))
except socket.error:
print(Fore.RED + (str(port) + ' is closed' + '\n'))
else:
s.close
print(Fore.GREEN + (str(port) + ' is open' + '\n'))
try:
s.connect((host, port))
except socket.error:
print(str(port) + ' is closed')
else:
s.close()
print(str(port) + ' is open')
for evt in p.listen():
. Простите за невнимательность.