twitter-api-client
twitter-api-client copied to clipboard
Uvloop broken in 3.11
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
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.
removing uvloop code works for me for now