Steve Dower added the comment:
This is covered by issue26227
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Windows: socket.gethostbyaddr(name) fails for non-ASCII hostname
___
Python tracker
Peter Hunt added the comment:
Ah, I just realised it may have been a different dash to the one that can be
typed with the keyboard.
>From the wiki article (https://en.wikipedia.org/wiki/Dash), using either the
>"en" or "em" dash will cause the issue for me on Windows.
--
Christian Heimes added the comment:
I cannot reproduce the issue on Linux:
# echo "127.0.0.2 xn-9q8h" >> /etc/hosts
# python3.8
>>> import socket
>>> socket.gethostbyaddr("127.0.0.2")
('xn-9q8h', [], ['127.0.0.2'])
--
nosy: +christian.heimes
versions: -Python 3.6, Python 3.7
New submission from Peter Hunt :
If the hosts file contains invalid unicode, then the socket module will break
when attempting to get the list of hosts. This renders modules such as Flask
and Django unusable.
Background:
I had a mapping to localghost