Issue with lists and "observed lists"
If anyone has gotten this error below, how did you fix it?
Ignoring exception in on_message
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 58, in on_message
options = options + encourge_options
TypeError: can only concatenate list (not "ObservedList") to list
Apparently either encourage_options or options is an “ObservedList” and you cannot add a list to an observed list.
Try converting the “ObservedList” to a list by using the list() function
Replit db actually extends on the list object, so what they return is not what python list really is.
Here is what I recommend doing:
arr = db['... list ...'] arr.append(... whatever ...) db['... list ...'] = arr