← Back to team overview

indiv-screenlets-dev team mailing list archive

[Bug 618868] Re: [Sysmonitor] sysmonitor screenlet fails to find the computer's IP address

 

** Changed in: indiv-screenlets
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of
Individual Screenlets Developers, which is subscribed to Individual
Screenlets.
https://bugs.launchpad.net/bugs/618868

Title:
  [Sysmonitor] sysmonitor screenlet fails to find the computer's IP
  address

Status in Screenlets — individual widgets development:
  Fix Released
Status in “indiv-screenlets” package in Ubuntu:
  Fix Released

Bug description:
  Binary package hint: screenlets

  Using Ubuntu 10.04.1 with screenlets 0.1.2-7ubuntu1
  The screenlet sysmonitor doesn't return an IP address but an empty string. This is due to a bug in the function net_get_ip().
  Here is the content of the function screenlets.sensors.net_get_ip().

  def net_get_ip(): # by Whise 
   442          """Returns ip if it can""" 
   443          ip = commands.getoutput("ifconfig") 
   444          x = 0 
   445          while True: 
   446                  ip = ip[ip.find("inet addr:"):] 
   447                  ip = ip[10:] 
   448                  ipc = ip[:ip.find(chr(32))] 
   449                  if ipc != '127.0.0.1' and ipc != None and ipc !='1':  
   450                           
   451                          return ipc 
   452                           
   453   
   454          return _('Cannot get ip') 

  There is an error on line 446. The ifconfig command doesn't return a string "inet addr" but "inet adr" instead (only one 'd'). 
  Because of this, the function doesn't return the ip address but an empty string.

  To correct the problem, lines 446 and 447 must be changed to this:
  446                  ip = ip[ip.find("inet adr:"):] 
  447                  ip = ip[9:] 

  This bug might or might not be related to this one: 
  bug #241557   - screenlets.sensors.net_get_ip() doesn't necessarily return the correct value

To manage notifications about this bug go to:
https://bugs.launchpad.net/indiv-screenlets/+bug/618868/+subscriptions