aiocometd icon indicating copy to clipboard operation
aiocometd copied to clipboard

TypeError: Semaphore.__init__() got an unexpected keyword argument 'loop' in transport/long_polling.py file

Open VamshiGitHu opened this issue 2 years ago • 3 comments

I am getting a type error when I run a python script. It gives me a type error with loops in semaphore, which was deprecated in the latest python releases.

Is there any alternatives for this issue?

VamshiGitHu avatar Feb 28 '23 06:02 VamshiGitHu

I have tried to find a solution to this but couldn't find a fix anywhere so I had to do something about it myself.

This is caused because 3.11 gets rid of the loop argument.

Fix:

  1. Edit transports/long_polling.py line 25 :

self._http_semaphore = asyncio.Semaphore(2)

  1. Edit client.py line 481 line to this (same thing, remove the loop argument and leave the rest as is):

done, pending = await asyncio.wait( tasks, return_when=asyncio.FIRST_COMPLETED)

Andrei-Ardei avatar Sep 12 '23 08:09 Andrei-Ardei

I have tried to find a solution to this but couldn't find a fix anywhere so I had to do something about it myself.

This is caused because 3.11 gets rid of the loop argument.

Fix:

  1. Edit transports/long_polling.py line 25 :

self._http_semaphore = asyncio.Semaphore(2)

  1. Edit client.py line 481 line to this (same thing, remove the loop argument and leave the rest as is):

done, pending = await asyncio.wait( tasks, return_when=asyncio.FIRST_COMPLETED)

Maintainer seems to not have anymore activity in maintaining the module, and indeed the quick fix is to remove the loop arguments from those files.

Did anybody fork and maintain this module separately that is published?

dizzydwarfus avatar Feb 29 '24 16:02 dizzydwarfus

I have tried to find a solution to this but couldn't find a fix anywhere so I had to do something about it myself. This is caused because 3.11 gets rid of the loop argument. Fix:

  1. Edit transports/long_polling.py line 25 :

self._http_semaphore = asyncio.Semaphore(2)

  1. Edit client.py line 481 line to this (same thing, remove the loop argument and leave the rest as is):

done, pending = await asyncio.wait( tasks, return_when=asyncio.FIRST_COMPLETED)

Maintainer seems to not have anymore activity in maintaining the module, and indeed the quick fix is to remove the loop arguments from those files.

Did anybody fork and maintain this module separately that is published?

It seems like yes: https://pypi.org/project/aiocometd-noloop/

haroldo-bonette avatar May 15 '24 15:05 haroldo-bonette