From de21eafe7b50791144d2bfca37ee721fe5cb00d7 Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Thu, 11 May 2017 21:18:27 +0200 Subject: [PATCH 1/3] Swapped out for a better error output. You had no idea where errors occured before. --- fbchat/client.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fbchat/client.py b/fbchat/client.py index 633124c..6aa5793 100644 --- a/fbchat/client.py +++ b/fbchat/client.py @@ -24,6 +24,7 @@ from .models import * from .stickers import * import time import sys +import traceback # Python 3 does not have raw_input, whereas Python 2 has and it's more secure try: @@ -653,7 +654,8 @@ class Client(object): for participant in j['payload']['participants']: participants[participant["fbid"]] = participant["name"] except Exception as e: - log.warning(str(j)) + traceback.print_exc() +# log.warning(str(j)) # Prevent duplicates in self.threads threadIDs = [getattr(x, "thread_id") for x in self.threads] @@ -1026,7 +1028,8 @@ class Client(object): def on_message_error(self, exception, message): """subclass Client and override this method to add custom behavior on event""" - log.warning("Exception:\n{}".format(exception)) + traceback.print_exc() +# log.warning("Exception:\n{}".format(exception)) def on_qprimer(self, timestamp): From e8fbaefa72f50521d784e58be0370fef32e79f2e Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Thu, 11 May 2017 21:23:18 +0200 Subject: [PATCH 2/3] There's no such thing as 'unicode' in Py3 --- fbchat/client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fbchat/client.py b/fbchat/client.py index 6aa5793..90a8f5d 100644 --- a/fbchat/client.py +++ b/fbchat/client.py @@ -897,7 +897,8 @@ class Client(object): if type(_fbid) == int: return _fbid - if type(_fbid) in [str, unicode] and 'fbid:' in _fbid: + print(type(_fbid)) + if type(_fbid) in [str, bytes] and 'fbid:' in _fbid: return int(_fbid[5:]) user_ids = [fbidStrip(uid) for uid in user_ids] From ac0e72d1677f46e5475561a98f6db85087934328 Mon Sep 17 00:00:00 2001 From: Lord Anton Hvornum Date: Thu, 11 May 2017 21:23:48 +0200 Subject: [PATCH 3/3] There's no such thing as 'unicode' in Py3 --- fbchat/client.py | 1 - 1 file changed, 1 deletion(-) diff --git a/fbchat/client.py b/fbchat/client.py index 90a8f5d..e0fa43f 100644 --- a/fbchat/client.py +++ b/fbchat/client.py @@ -897,7 +897,6 @@ class Client(object): if type(_fbid) == int: return _fbid - print(type(_fbid)) if type(_fbid) in [str, bytes] and 'fbid:' in _fbid: return int(_fbid[5:])