Twint: RuntimeError: Cannot run the event loop while another loop is running

Created on 12 Feb 2020  路  3Comments  路  Source: twintproject/twint

Issue Template

Please use this template!

Command Ran

import twint

c = twint.Config()
c.Username = "now"
c.Search = "fruit"

twint.run.Search(c)

Description of Issue

RuntimeError                              Traceback (most recent call last)
<ipython-input-1-6687918a92c0> in <module>
      7 
      8 # Run
----> 9 twint.run.Search(c)

c:\users\\\data science\src\twint\twint\run.py in Search(config, callback)
    286     config.Profile = False
    287     config.Profile_full = False
--> 288     run(config, callback)
    289     if config.Pandas_au:
    290         storage.panda._autoget("tweet")

c:\users\\\data science\src\twint\twint\run.py in run(config, callback)
    209     loop = new_event_loop()
    210     set_event_loop(loop)
--> 211     loop.run_until_complete(Twint(config).main(callback))
    212 
    213 def Favorites(config):

~\AppData\Local\Continuum\anaconda3\envs\scraping\lib\asyncio\base_events.py in run_until_complete(self, future)
    473         future.add_done_callback(_run_until_complete_cb)
    474         try:
--> 475             self.run_forever()
    476         except:
    477             if new_task and future.done() and not future.cancelled():

~\AppData\Local\Continuum\anaconda3\envs\scraping\lib\asyncio\base_events.py in run_forever(self)
    430         if events._get_running_loop() is not None:
    431             raise RuntimeError(
--> 432                 'Cannot run the event loop while another loop is running')
    433         self._set_coroutine_wrapper(self._debug)
    434         self._thread_id = threading.get_ident()

RuntimeError: Cannot run the event loop while another loop is running

Environment Details

Windows

Compatibility

Most helpful comment

You can just import nest_asyncio and add nest_asyncio.apply() to your code to run on Anaconda.

All 3 comments

Compatibility issue with anaconda3

Try to use it with the native interpreter

Installed using pip install within a conda environment. I do not have any other envs. I have many environments and I don't want to use my native python to install packages. (base is conda, too....)

You can just import nest_asyncio and add nest_asyncio.apply() to your code to run on Anaconda.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Nestor75 picture Nestor75  路  3Comments

psubbiah picture psubbiah  路  4Comments

PatricioAlvarado picture PatricioAlvarado  路  4Comments

wagerpascal picture wagerpascal  路  4Comments

philuchansky picture philuchansky  路  3Comments