ipcheck suffers exception; NoneType object has no attribute 'close'

Bug #756657 reported by Ralph Corderoy
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ipcheck (Debian)
Fix Released
ipcheck (Ubuntu)
Fix Released

Bug Description

Binary package hint: ipcheck

ipcheck version 0.233-1 gives

    Traceback (most recent call last):
      File "/usr/sbin/ipcheck", line 5518, in <module>
      File "/usr/sbin/ipcheck", line 5198, in _main
      File "/usr/lib/python2.6/socket.py", line 273, in close
    AttributeError: 'NoneType' object has no attribute 'close'

Lines of interest are

    $ cat -n /usr/sbin/ipcheck | sed -n 5190,5198p
      5190 try:
      5191 fp = h2.getfile()
      5192 httpdata = fp.read()
      5193 fp.close()
      5194 except:
      5195 httpdata = "No output from http request."
      5197 # explicitly close
      5198 fp.close()

It seems h2.getfile() is returning None causing problems when fp.close()
is attempted outside of the try-block.

Related branches

Revision history for this message
Ralph Corderoy (ralph-inputplus) wrote :

Having had time to work around it, fp isn't None, but fp._sock is. Changing line 5198 to

    if fp and fp._sock: fp.close()

lets the program continue to apparently successful conclusion. I don't suggest this as the proper fix though. Without the work around, ipcheck.dat doesn't contain useful data.

Changed in ipcheck (Debian):
status: Unknown → New
Changed in ipcheck (Debian):
status: New → Fix Committed
Changed in ipcheck (Debian):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ipcheck - 0.233-1.1

ipcheck (0.233-1.1) unstable; urgency=low

  * Non-maintainer upload.
  * Fix "on python2.6: AttributeError: 'NoneType' object has no
    attribute 'close'" (Closes: #587698, LP: #756657)

 -- Miguel de Val Borro <email address hidden> Sun, 04 Dec 2011 15:57:08 +0100

Changed in ipcheck (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.