From 9763d8b26c5482786d1e835787fba13b7c038742 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Fri, 15 Feb 2019 09:04:52 -0600 Subject: [PATCH] Fixed an error when trying to retrieve a deleted user while rendering a direct message --- src/sessions/twitter/session.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sessions/twitter/session.py b/src/sessions/twitter/session.py index fbcd429d..be1a3fdd 100644 --- a/src/sessions/twitter/session.py +++ b/src/sessions/twitter/session.py @@ -411,7 +411,11 @@ class Session(base.baseSession): id str: User identifier, provided by Twitter. returns an user dict.""" if ("users" in self.db) == False or (id in self.db["users"]) == False: - user = self.twitter.show_user(id=id) + try: + user = self.twitter.show_user(id=id) + except TwythonError: + user = dict(screen_name="deleted_account", name="Deleted account") + return user self.db["users"][user["id_str"]] = user return user else: