codingjoe / ssdp

Python asyncio library for Simple Service Discovery Protocol (SSDP).
https://en.wikipedia.org/wiki/Simple_Service_Discovery_Protocol
MIT License
41 stars 12 forks source link

DeprecationWarning: There is no current event loop #71

Closed greghesp closed 1 year ago

greghesp commented 1 year ago

I'm not a too knowledgeable with python at the moment, however I noticed that when running the request example, the following error is returned

DeprecationWarning: There is no current event loop
  loop = asyncio.get_event_loop()
Exception in callback _ProactorDatagramTransport._loop_reading()
handle: <Handle _ProactorDatagramTransport._loop_reading()>
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\asyncio\proactor_events.py", line 569, in _loop_reading
    self._read_fut = self._loop._proactor.recvfrom(self._sock,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\asyncio\windows_events.py", line 499, in recvfrom
    ov.WSARecvFrom(conn.fileno(), nbytes, flags)
OSError: [WinError 10022] An invalid argument was supplied

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\asyncio\proactor_events.py", line 572, in _loop_reading
    self._protocol.error_received(exc)
  File "C:\Users\gregh\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\ssdp\__init__.py", line 177, in error_received
    raise IOError("Unexpected connection error") from exc
OSError: Unexpected connection error
alessandromannini commented 1 year ago

Hi,

i have the same exception on a Windows system and no devices are discovere? Have you solved?

Thx Alessandro

alessandromannini commented 1 year ago

The complete message I receive is:

Exception in callback _ProactorDatagramTransport._loop_reading()
handle: <Handle _ProactorDatagramTransport._loop_reading()>
Traceback (most recent call last):
  File "C:\Python39\lib\asyncio\proactor_events.py", line 566, in _loop_reading
    self._read_fut = self._loop._proactor.recvfrom(self._sock,
  File "C:\Python39\lib\asyncio\windows_events.py", line 494, in recvfrom
    ov.WSARecvFrom(conn.fileno(), nbytes, flags)
OSError: [WinError 10022] Argomento fornito non valido

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Python39\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Python39\lib\asyncio\proactor_events.py", line 569, in _loop_reading
    self._protocol.error_received(exc)
  File "C:\Python39\lib\site-packages\ssdp\__init__.py", line 177, in error_received
    raise IOError("Unexpected connection error") from exc
OSError: Unexpected connection error
codingjoe commented 1 year ago

Hi there,

The latest version, v1.2 fixes many issues concerning Windows. You can try the new CLI to verify that it's working on your system. The new documentation should also help you to implement a working solution.

Cheers! Joe