Message259081
Python 2.7.11:
>>> import socket
>>> socket.gethostname()
'\xc9manuel-PC'
This one works on Python 3 because the Python function is implemented with a call to the Windows native API.
>>> socket.gethostbyaddr(socket.gethostname())
('\xc9manuel-PC.home', [], ['fe80::c9b7:5117:eea4:a104'])
This one fails on Python 3 because it uses the gethostbyaddr() C function and then decodes the hostname from UTF-8, whereas the hostname looks more to be encoded to ISO 8859-1 or something like that. IMHO it should be decoded from the ANSI code page.
I opened the issue #26227 to track this bug. |
|
Date |
User |
Action |
Args |
2016-01-28 01:10:15 | vstinner | set | recipients:
+ vstinner, abarry |
2016-01-28 01:10:15 | vstinner | set | messageid: <1453943415.23.0.44809658142.issue26226@psf.upfronthosting.co.za> |
2016-01-28 01:10:15 | vstinner | link | issue26226 messages |
2016-01-28 01:10:15 | vstinner | create | |
|