Skip to content

Commit

Permalink
Fix Log Warning on Shutdown
Browse files Browse the repository at this point in the history
Upon shutdown, this error was displayed:
Exception AttributeError: "'NoneType' object has no attribute 'debug'" in <bound method Connection.__del__ of <happybase.api.Connection object at 0x106878250>> ignored
  • Loading branch information
defcube committed Feb 3, 2013
1 parent 42935cb commit af97c3f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion happybase/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ def close(self):
This method closes the underlying Thrift transport (TCP connection).
"""
logger.debug("Closing Thrift transport to %s:%d", self.host, self.port)
if logger:
# since close() is called during __del__, sometimes logger doesn't
# exist anymore
logger.debug("Closing Thrift transport to %s:%d", self.host,
self.port)
self.transport.close()

def __del__(self):
Expand Down

0 comments on commit af97c3f

Please sign in to comment.