I get "NotImplementedError" using the asynchronous version of socketio
See original GitHub issueHi @miguelgrinberg I am implementing socketio inside a discord bot. I have to use the asynchronous version of socketio because discord.py is asynchronous. Using the synchronous version of socketio everything works fine, when I use the asynchronous version the following error occurs:
Ignoring exception in command verify:
Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\gatto\OneDrive\Desktop\Python\Bot Discord CG\sub_verify.py", line 28, in verify
await sio.connect('http://localhost:8000')
File "C:\Users\gatto\AppData\Roaming\Python\Python37\site-packages\socketio\asyncio_client.py", line 111, in connect
engineio_path=socketio_path)
File "C:\Users\gatto\AppData\Roaming\Python\Python37\site-packages\engineio\asyncio_client.py", line 87, in connect
async_signal_handler)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\asyncio\events.py", line 540, in add_signal_handler
raise NotImplementedError
NotImplementedError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\discord\ext\commands\bot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\discord\ext\commands\core.py", line 855, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotImplementedError:
This is my code:
import socketio
import discord
from discord.ext import commands
import time
import asyncio
data = time.strftime("%d/%m/%Y")
ora = time.strftime("%H:%M:%S")
sio = socketio.AsyncClient(logger=True, engineio_logger=True)
@sio.event()
async def url_received(data):
print(data)
class Sub(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def verify(self, ctx):
if ctx.message.channel.id == 749357312048758805:
embed = discord.Embed(title="TEST", description="**TEST DESCRIPTION!**", color=0x00ff00)
embed.set_footer(text="TEST MESSAGE | {}".format(data))
await sio.connect('http://127.0.0.1:5000/')
await sio.emit("URL REQUEST")
await ctx.send(embed=embed)
What is the cause of this? If you need more information, please ask. Thanks in advance.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Why am I getting NotImplementedError with async and await ...
To run your code in Windows you can use alternative event loop available by default - ProactorEventLoop . Replace line: loop = asyncio....
Read more >How to Add Websockets to a Django App without Extra ...
In this post, you'll learn how to handle Websockets with Django by extending the default ASGI application. We'll go over how to handle...
Read more >Getting Started — python-socketio documentation
This package provides Python implementations of both, each with standard and asyncio variants. Version compatibility¶. The Socket.IO protocol has been through a ...
Read more >Rasa is not able to handle more than 4/5 concurrent requests
In my view.py i am using all async functions . I have tested with multiple users using a non-blocking sleep statement : await...
Read more >ssl — TLS/SSL wrapper for socket objects — Python 3.11.1 ...
Changed in version 3.5.3: Updated to support linking with OpenSSL 1.1.0 ... with a SSLContext created by this function that they get an...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, I got the same error. It helped me to get back to version python-engineio-3.13.1
Fixed by https://github.com/miguelgrinberg/python-engineio/commit/c0a1c2801cb35e6d192ddf542f79359c823655aa.