00001 #!/usr/bin/env python 00002 # warning: we don't express a rosdep on netifaces. This is part of the eddiebot image 00003 import sys 00004 import netifaces 00005 00006 for inf in netifaces.interfaces(): 00007 if inf.startswith('wlan'): 00008 addrs = netifaces.ifaddresses(inf) 00009 if not netifaces.AF_INET in addrs: 00010 continue 00011 else: 00012 print addrs[netifaces.AF_INET][0]['addr'] 00013 break 00014 else: 00015 print >> sys.stderr, "failed to determine IP address" 00016 print "127.0.0.1" #bind to loopback for now 00017 sys.exit(1)