UnboundLocalError: local variable 'sessions_temp' referenced before assignment #2

Closed
opened 2022-08-19 08:49:49 +02:00 by spla · 1 comment
spla commented 2022-08-19 08:49:49 +02:00 (Migrated from codeberg.org)

The code throws this error after demanding "sessions" to the bot:

Traceback (most recent call last):
File "xmpp.py", line 104, in
sessions = ejabberd.user_sessions_info(mention.acct, bot.mastodon_hostname)
File "/home/mastodon/bots/xmppbot/ejabberdapi.py", line 213, in user_sessions_info
sessions = self.__json_allow_dict_attrs(sessions_temp)
UnboundLocalError: local variable 'sessions_temp' referenced before assignment

The code throws this error after demanding "sessions" to the bot: Traceback (most recent call last): File "xmpp.py", line 104, in <module> sessions = ejabberd.user_sessions_info(mention.acct, bot.mastodon_hostname) File "/home/mastodon/bots/xmppbot/ejabberdapi.py", line 213, in user_sessions_info sessions = self.__json_allow_dict_attrs(sessions_temp) UnboundLocalError: local variable 'sessions_temp' referenced before assignment
spla commented 2022-08-19 09:23:40 +02:00 (Migrated from codeberg.org)

If there is not any active session, the response of the Ejabberd API is []:

(Pdb) response.json()
[]

so sessions_temp is not referenced.

If there is not any active session, the response of the Ejabberd API is []: (Pdb) response.json() [] so sessions_temp is not referenced.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: spla/xmppbot.py#2
No description provided.