[sebsauvage.net]
def getLocalIP():
''' Renvoie l'adresse IP local (LAN). '''
try:
return socket.gethostbyname_ex('')[2][0]
except socket.herror:
pass
try:
return socket.gethostbyname(socket.gethostname())
except:
pass
raise socket.error, "Unable to determine LAN IP address."