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

Most upvoted comments

The fix has already been merged. Just do pip install -U git+https://github.com/dolfies/discord.py-self

I 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

Corrigi isso temporariamente alterando a linha 1036 em discord/state.py do seguinte: self.pending_payments = {int(p[‘id’]): Payment(state=self, data=p) for p in data.get(‘pending_payments’, [])} para o seguinte: self.pending_payments = None

This worked for me.

I 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.