Skip to content

RuntimeError: asyncio.run() cannot be called from a running event loop #771

Description

@boral

While running Readme example facing this

'''
result = smart_scraper_graph.run()
--- Executing Fetch Node ---
--- (Fetching HTML from: https://scrapegraphai.com/) ---
Traceback (most recent call last):

Cell In[5], line 1
result = smart_scraper_graph.run()

File ~\anaconda3\envs\test\Lib\site-packages\scrapegraphai\graphs\smart_scraper_graph.py:114 in run
self.final_state, self.execution_info = self.graph.execute(inputs)

File ~\anaconda3\envs\test\Lib\site-packages\scrapegraphai\graphs\base_graph.py:263 in execute
return self._execute_standard(initial_state)

File ~\anaconda3\envs\test\Lib\site-packages\scrapegraphai\graphs\base_graph.py:184 in _execute_standard
raise e

File ~\anaconda3\envs\test\Lib\site-packages\scrapegraphai\graphs\base_graph.py:168 in _execute_standard
result = current_node.execute(state)

File ~\anaconda3\envs\test\Lib\site-packages\scrapegraphai\nodes\fetch_node.py:126 in execute
return self.handle_web_source(state, source)

File ~\anaconda3\envs\test\Lib\site-packages\scrapegraphai\nodes\fetch_node.py:284 in handle_web_source
document = loader.load()

File ~\anaconda3\envs\test\Lib\site-packages\langchain_core\document_loaders\base.py:31 in load
return list(self.lazy_load())

File ~\anaconda3\envs\test\Lib\site-packages\scrapegraphai\docloaders\chromium.py:111 in lazy_load
html_content = asyncio.run(scraping_fn(url))

File ~\anaconda3\envs\test\Lib\asyncio\runners.py:186 in run
raise RuntimeError(

RuntimeError: asyncio.run() cannot be called from a running event loop
'''

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions