Skip to content

Commit

Permalink
Get "hostname.local" if "hostname" ip not found
Browse files Browse the repository at this point in the history
  • Loading branch information
alanjds committed Dec 24, 2016
1 parent fb87f25 commit 87a34f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Binary file modified libs/garden/garden.navigationdrawer/__init__.pyc
Binary file not shown.
6 changes: 5 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ class MainScreen(Screen):
def __init__(self, **kwargs):
super(MainScreen, self).__init__(**kwargs)

ip = socket.gethostbyname(socket.gethostname())
try:
ip = socket.gethostbyname(socket.gethostname())
except socket.gaierror:
ip = socket.gethostbyname(socket.gethostname() + '.local')

if ip.startswith('127.'):
interfaces = ['eth0', 'eth1', 'eth2', 'wlan0', 'wlan1', 'wifi0',
'tiwlan0', 'tiwlan1', 'ath0', 'ath1', 'ppp0']
Expand Down

0 comments on commit 87a34f4

Please sign in to comment.