[issue10097] platform.uname gives UnicodeError for non-ASCII computer names on Windows

Martin v. Löwis report at bugs.python.org
Thu Oct 14 19:02:04 CEST 2010


Martin v. Löwis <martin at v.loewis.de> added the comment:

> There are two issues here:

There are two issues, but not here :-)

> 1. socket.gethostname() shouldn't raise an error on Windows, but
>    return the Unicode host name

This is issue 9377, please keep that out of this issue.

> Could someone please check whether using the environment
> variable COMPUTERNAME would work in the described case ?

No - I didn't personally encounter the problem.

> What we could do is use the socket.gethostname() and fall back
> to COMPUTERNAME in case of decoding problems.

I think using socket.gethostname() is conceptually wrong: the
what uname returns is *not* the name the machine has in DNS,
but what is configured in the kernel.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10097>
_______________________________________


More information about the Python-bugs-list mailing list