twitter-api-client icon indicating copy to clipboard operation
twitter-api-client copied to clipboard

Uvloop broken in 3.11

Open Paradigm00 opened this issue 1 year ago • 2 comments

Hello I tested this code almost 2 weeks ago and was everything ok, now something is broken.

The following code block is resulting in an error:

Error in Scraper._process(): TypeError: 'Task' object is not callable

def test_t1(self):
        a = Scraper(session=init_session())
        b = a.users(['elonmusk'])
Exception in callback <Task pending name='Task-1' coro=<Scraper._process() running at [PATH]/venv/lib/python3.11/site-packages/twitter/scraper.py:603> cb=[run_until_complete.<locals>.done_cb()]>
handle: <Handle <Task pending name='Task-1' coro=<Scraper._process() running at [PATH]/venv/lib/python3.11/site-packages/twitter/scraper.py:603> cb=[run_until_complete.<locals>.done_cb()]>>
Traceback (most recent call last):
 File "uvloop/cbhandles.pyx", line 61, in uvloop.loop.Handle._run
TypeError: 'Task' object is not callable

Removing uvloop.install() or placing asyncio.get_event_loop_policy().new_event_loop() before the rest of the code allows the test to pass. However, these fixes are not working for my actual project, which is built around asyncio, where it still fails and throws another error: Can't patch loop of type <class 'uvloop.Loop'>. how can i resolve this?

thank you

Paradigm00 avatar Feb 08 '24 10:02 Paradigm00

I have this same issue with Python 3.10.

It was working until about a week ago. I'm assuming some dependency somewhere got updated on my side.

takabinance avatar Feb 12 '24 23:02 takabinance

removing uvloop code works for me for now

takabinance avatar Feb 12 '24 23:02 takabinance