This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lemburg
Recipients lemburg, loewis
Date 2010-10-14.08:38:27
SpamBayes Score 1.9643528e-08
Marked as misclassified No
Message-id <4CB6C181.6070109@egenix.com>
In-reply-to <1287036613.43.0.313046805894.issue10097@psf.upfronthosting.co.za>
Content
Martin v. Löwis wrote:
> 
> New submission from Martin v. Löwis <martin@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/
History
Date User Action Args
2010-10-14 08:38:29lemburgsetrecipients: + lemburg, loewis
2010-10-14 08:38:27lemburglinkissue10097 messages
2010-10-14 08:38:27lemburgcreate