Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
VamshiGitHu opened this issue Feb 28, 2023 · 3 comments

Comments

@VamshiGitHu
Copy link

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 VamshiGitHu changed the title TypeError: Semaphore.__init__() got an unexpected keyword argument 'loop' in long pooling.py class TypeError: Semaphore.__init__() got an unexpected keyword argument 'loop' in transport/long_polling.py file Feb 28, 2023
@Andrei-Ardei
Copy link

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)

@dizzydwarfus
Copy link

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?

@haroldo-bonette
Copy link

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants