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 (

I believe my the issue lies in the following section

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

if I put an ip address in the section s.connect(('', 1)) that is valid on the subnet the nanopi receives it ip address in (ie, 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.