Hi all

Sorry for the noob question but my python knowledge is near 0 so I am struggling to figure this out.

I have a nanopi neo with the nanoled hat that loads the bakebit_nanohat_oled.py script but it keeps displaying the loopback address (127.0.0.1)

I believe my the issue lies in the following section

def get_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
# doesn't even have to be reachable
s.connect(('10.255.255.255', 1))
IP = s.getsockname()[0]
except:
IP = '127.0.0.1'
finally:
s.close()
return IP


if I put an ip address in the section s.connect(('10.255.255.255', 1)) that is valid on the subnet the nanopi receives it ip address in (ie 12.1.1.1, which does not actually exist) then it displays the ip address that was assigned to by DHCP.

Any ideas to resolve this would be appreciated.