From 689648ba32840bf82207548d5c0813b6d823b3ee Mon Sep 17 00:00:00 2001 From: Matt Porritt Date: Fri, 22 May 2015 17:11:21 +1000 Subject: [PATCH] fixing close method that is called as part of __del__. No longer throws error trying to call an attribute that will not exist if object fails during instantiation --- socketIO_client/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/socketIO_client/__init__.py b/socketIO_client/__init__.py index dfe41e5..3d8d476 100644 --- a/socketIO_client/__init__.py +++ b/socketIO_client/__init__.py @@ -173,7 +173,10 @@ class EngineIO(LoggingMixin): def _close(self): self._wants_to_close = True - self._heartbeat_thread.halt() + try: + self._heartbeat_thread.halt() + except AttributeError: + pass if not self._opened: return engineIO_packet_type = 1