OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

My discord.py bot gives a runtime error when trying to use aiohttp package

  • Thread starter Thread starter toti
  • Start date Start date
T

toti

Guest
I tried to use an api for my discord bot using nest_asyncio and aiohttp

Code:
Traceback (most recent call last):
  File "c:\Users\\Desktop\TPLbot\main.py", line 296, in <module>
    client.run(os.getenv("DISCORD_TOKEN"))
  File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\discord\client.py", line 869, in run
    asyncio.run(runner())
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\discord\client.py", line 858, in runner
    await self.start(token, reconnect=reconnect)
  File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\discord\client.py", line 786, in start
    await self.login(token)
  File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\discord\client.py", line 620, in login
    data = await self.http.static_login(token)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\discord\http.py", line 816, in static_login
    data = await self.request(Route('GET', '/users/@me'))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\discord\http.py", line 642, in request
    data = await json_or_text(response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\discord\http.py", line 107, in json_or_text
    text = await response.text(encoding='utf-8')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\aiohttp\client_reqrep.py", line 1086, in text
    await self.read()
  File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\aiohttp\client_reqrep.py", line 1044, in read
    self._body = await self.content.read()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\aiohttp\streams.py", line 357, in read
    raise self._exception
aiohttp.client_exceptions.ClientPayloadError: DeflateBuffer.feed_data() takes 2 positional arguments but 3 were given

i tried updating all the packages i mentioned before, resetting my token, and nothing works, how do i fix this? (by the way, double slashes are me deleting my pc name)
<p>I tried to use an api for my discord bot using nest_asyncio and aiohttp</p>
<pre><code>Traceback (most recent call last):
File "c:\Users\\Desktop\TPLbot\main.py", line 296, in <module>
client.run(os.getenv("DISCORD_TOKEN"))
File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\discord\client.py", line 869, in run
asyncio.run(runner())
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\discord\client.py", line 858, in runner
await self.start(token, reconnect=reconnect)
File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\discord\client.py", line 786, in start
await self.login(token)
File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\discord\client.py", line 620, in login
data = await self.http.static_login(token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\discord\http.py", line 816, in static_login
data = await self.request(Route('GET', '/users/@me'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\discord\http.py", line 642, in request
data = await json_or_text(response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\discord\http.py", line 107, in json_or_text
text = await response.text(encoding='utf-8')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\aiohttp\client_reqrep.py", line 1086, in text
await self.read()
File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\aiohttp\client_reqrep.py", line 1044, in read
self._body = await self.content.read()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\\Desktop\TPLbot\.venv\Lib\site-packages\aiohttp\streams.py", line 357, in read
raise self._exception
aiohttp.client_exceptions.ClientPayloadError: DeflateBuffer.feed_data() takes 2 positional arguments but 3 were given
</code></pre>
<p>i tried updating all the packages i mentioned before, resetting my token, and nothing works, how do i fix this? (by the way, double slashes are me deleting my pc name)</p>
 
Top