Skip to content

"There is no current event loop in thread 'Thread-1 (start)' " Error in shell #5771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
smohsenmohseni opened this issue Dec 25, 2022 · 1 comment

Comments

@smohsenmohseni
Copy link

Hi, I ran scrapy shell and fetch('https://www.example.com') then I got an error related to "There is no current event loop in thread 'Thread-1 (start)' "

the error that I get

2022-12-25 12:51:33 [scrapy.core.scraper] ERROR: Spider error processing <GET https://www.google.com/> (referer: None)
Traceback (most recent call last):
  File "/home/mohsn/Documents/lrn_scrap/venv/lib/python3.10/site-packages/twisted/internet/defer.py", line 892, in _runCallbacks
    current.result = callback(  # type: ignore[misc]
  File "/home/mohsn/Documents/lrn_scrap/venv/lib/python3.10/site-packages/scrapy/utils/defer.py", line 285, in f
    return deferred_from_coro(coro_f(*coro_args, **coro_kwargs))
  File "/home/mohsn/Documents/lrn_scrap/venv/lib/python3.10/site-packages/scrapy/utils/defer.py", line 272, in deferred_from_coro
    event_loop = get_asyncio_event_loop_policy().get_event_loop()
  File "/usr/lib/python3.10/asyncio/events.py", line 656, in get_event_loop
    raise RuntimeError('There is no current event loop in thread %r.'
RuntimeError: There is no current event loop in thread 'Thread-1 (start)'.
2022-12-25 12:51:33 [py.warnings] WARNING: /home/mohsn/Documents/lrn_scrap/venv/lib/python3.10/site-packages/twisted/internet/defer.py:892: RuntimeWarning: coroutine 'SpiderMiddlewareManager.scrape_response.<locals>.process_callback_output' was never awaited
  current.result = callback(  # type: ignore[misc]

scrapy version is 2.7.1
python version is 3.10.6

that works for me in scrapy version 2.7.0

@wRAR
Copy link
Member

wRAR commented Dec 25, 2022

Duplicate of #5740

@wRAR wRAR marked this as a duplicate of #5740 Dec 25, 2022
@wRAR wRAR closed this as not planned Won't fix, can't repro, duplicate, stale Dec 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants