James Crowther <jamesharrycrowt...@gmail.com> added the comment:

Hi guys, I am the OP for the stack overflow issue question that sparked this 
bug report. 


In response to Ned's question about configuration of the system:

MacOS 10.14.1
Installed x-code and command line tools
python versions used, varies, 3.5.3, 3.6 and 3.7.0 (sorry can't be more 
specific about 3.6 since I've used a lot. These python configurations have been 
both a bundled python env in blender, and also MacOS's native python 2.7.

So far they've all had the same issue, that being;

socket.gethostname() 

returns a value that seems to be set by the router/switch if 

scutil --set hostname somehostname 

has not been run. What Sorin mentioned on the stack overflow question that he 
didn't here (and I feel is important) is that ping and nslookup work with the 
expected hostname, i.e. the one the user can actually see by going to the 
system preferences and viewing it under the sharing section. Here it is called 
"Computer name", analogous to the same used on windows (which I might add has 
no such issues with hostnames being set to something other than the computer 
name unless a certain command is run).

So the real issue for us, is how come ping and nslookup will work fine with the 
macOS "computer name" but the socket module uses something else, seemingly the 
hostname and computer name are not or loosely connected on macOS perhaps. 

Ideally what we need here is a way to ensure that the user can input the 
computer name of a target machine on another system and that system resolve the 
ip address for the target machine. We can't currently use socket.gethostname 
for this on mac since it seems to require that the scutil --set hostname 
command has been run. Otherwise the hostname that is returned doesn't work with 
socket.gethostbyname(hostname).

Hope this helps, happy to clarify.

J.

----------
nosy: +James Crowther

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

Reply via email to