From c39151e7468f8d42d648eeb51b491cc48aa5f7f3 Mon Sep 17 00:00:00 2001 From: croneter Date: Fri, 26 Feb 2021 13:08:05 +0100 Subject: [PATCH] Fix UnboundLocalError: local variable 'user' referenced before assignment --- resources/lib/service_entry.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/resources/lib/service_entry.py b/resources/lib/service_entry.py index c3390b3b..28c30612 100644 --- a/resources/lib/service_entry.py +++ b/resources/lib/service_entry.py @@ -360,6 +360,7 @@ class Service(object): app.ACCOUNT.set_authenticated() return True + user = None while True: # Could not use settings - try to get Plex user list from plex.tv if app.ACCOUNT.plex_token: @@ -415,11 +416,15 @@ class Service(object): utils.settings('username', value=username) utils.settings('userid', value=user_id) utils.settings('accessToken', value=token) - utils.settings('plex_restricteduser', - 'true' if user.isManaged else 'false') + if user: + utils.settings('plex_restricteduser', + 'true' if user.isManaged else 'false') + app.CONN.restricted_user = user.isManaged + else: + utils.settings('plex_restricteduser', 'false') + app.CONN.restricted_user = False app.ACCOUNT.load() app.ACCOUNT.set_authenticated() - app.CONN.restricted_user = user.isManaged return True def ServiceEntryPoint(self):