Marc-Andre Lemburg <m...@egenix.com> added the comment:

Martin v. Löwis wrote:
> 
> New submission from Martin v. Löwis <mar...@v.loewis.de>:
> 
> Reportedly, platform.uname gives UnicodeError for non-ASCII computer names on 
> Windows, see http://www.pasteall.org/16215
> 
> I think it is incorrect that _node uses socket.gethostname on Windows. 
> uname() should return the local hostname (i.e. the one that the system itself 
> believes to have), independent of the network configuration or DNS.
> 
> Therefore, I think it should return the COMPUTERNAME environment variable, or 
> the result of the GetComputerName() API.

There are two issues here:

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

2. COMPUTERNAME returns an uppercase version of the host name (which we
   could lowercase to stay b/w compatible), however I'm not sure
   whether this is the same as the socket.gethostname() or the
   NETBIOS name and I'm also not sure whether this is always set.

   This link suggests that it's using the NetBIOS name:
   
http://www.scriptlogic.com/support/CustomScripts/environmentVariableReference.html

   The official Microsoft page is unclear about this:
   http://technet.microsoft.com/en-gb/library/bb490954.aspx

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

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

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com

________________________________________________________________________

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/

----------
nosy: +lemburg
title: platform.uname gives UnicodeError for non-ASCII computer names on 
Windows -> platform.uname gives UnicodeError for non-ASCII computer    names on 
Windows

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10097>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to