question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RuntimeError: This event loop is already running is still an issue

See original GitHub issue
~\anaconda3\lib\site-packages\TikTokApi\tiktok.py in _initialize(self, **kwargs)
    161 
    162         if self._signer_url is None:
--> 163             self._browser = asyncio.get_event_loop().run_until_complete(
    164                 asyncio.gather(browser.create(**kwargs))
    165             )[0]

This is where the issue happens.

Like others, I am just trying to get TiktokApi to initialize using with TikTokApi() as api:

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
soniaseguzcommented, Oct 7, 2022

For jupyter, try adding

import nest_asyncio
nest_asyncio.apply()
0reactions
batmanscodecommented, Oct 27, 2022

For jupyter, try adding

import nest_asyncio
nest_asyncio.apply()

Thanks! Will give this a try next time I use it

Read more comments on GitHub >

github_iconTop Results From Across the Web

RuntimeError: This event loop is already running in python
I got the issue resolved by using the nest_async pip install nest-asyncio. and adding below lines in my file.
Read more >
How to get around “RuntimeError: This event loop is already ...
After a little more research I found that the ipython kernel itself runs on an event loop, and as of Tornado 5.0, it's...
Read more >
This event loop is already running" When attempting REPL ...
I assume upgrading to 3.9 would improve this, still saw issues, and downgraded to 3.8.3 - still having issues with sync_playwright: import ...
Read more >
Event Loop — Python 3.11.1 documentation
The event loop is the core of every asyncio application. Event loops run asynchronous tasks and callbacks, perform network IO operations, and run...
Read more >
"event loop is already running" while trying to run `prodigy.serve`
I'm trying to use Prodigy via the Python API, but hitting an unexpected error. I'm just trying something basic, so let's say this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found