discord.py-self: TypeError: 'NoneType' object is not iterable - Payments
Summary
File "/home/acheong/Applications/discord/venv/lib/python3.13/site-packages/discord/gateway.py", line 625, in poll_event
await self.received_message(msg.data)
File "/home/acheong/Applications/discord/venv/lib/python3.13/site-packages/discord/gateway.py", line 572, in received_message
func(data)
~~~~^^^^^^
File "/home/acheong/Applications/discord/venv/lib/python3.13/site-packages/discord/state.py", line 1608, in parse_ready
self.pending_payments = {int(p['id']): Payment(state=self, data=p) for p in data.get('pending_payments', [])}
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not iterable
Previously, pending_payments would not be set. Now, it is set to null/None. Instead of data.get('pending_payments', []), use data.get('pending_payments') or []
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 16 (2 by maintainers)
Commits related to this issue
- fix #791: pending_payments might be set to None, use `or` — committed to gptlang/discord.py-self by acheong08 2 years ago
- fix #791: pending_payments might be set to None, use `or` (#792) Co-authored-by: Antonio Cheong <acheong@duti.dev> — committed to dolfies/discord.py-self by gptlang 2 years ago
- Update state.py https://github.com/dolfies/discord.py-self/issues/791 — committed to chalicem8/discord.py-self-copy by chalicem8 2 years ago
- Update state.py https://github.com/dolfies/discord.py-self/issues/791 — committed to chalicem8/discord.py-self-copy by chalicem8 2 years ago
The fix has already been merged. Just do
pip install -U git+https://github.com/dolfies/discord.py-selfI temporarily fixed this by changing line 1036 in discord/state.py from the following: self.pending_payments = {int(p[‘id’]): Payment(state=self, data=p) for p in data.get(‘pending_payments’, [])} to the following: self.pending_payments = None
This worked for me.
This worked for me.