-
Notifications
You must be signed in to change notification settings - Fork 120
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
Unable to use on Windows? NotImplementedError of _make_subprocess_transport for SelectorEventLoop #7
Comments
Indeed, it seems to me like it's currently not possible to run scrapy-playwright on Windows. In the link to the Python docs that you posted, it says that
Playwright does make use of subprocesses, but the only available Twisted reactor based on Regarding the Windows Subsystem for Linux, I have zero experience with that, and I don't have access to a Windows machine to try it. If you do go that way, I'd very much appreciate you coming back and reporting your findings. |
Hi, with WSL2, at least wsl2 on Ubuntu 20.04 LTS works quite well. It does not need any specific settings (like setting up Those links can help if choose to use wsl2 instead of installing Linux:
|
…-plugins/scrapy-playwright#7), going to try to use Windows Subsystem for Linux
Hi, I need to run both scrapy and playwright on a Windows computer, I don't know much about event loops, but still want to ask you after consulting the only explanation of ProactorEventLoop in the official Python document and twisted's own implementation of windows iocpreactor, is it impossible for the two to run compatible? And this is the only related PR I found in twisted project. |
AFAICT there hasn't been any development on this, my original comment still applies. |
@elacuesta Ok, thank you very much for your reply! BTW, the official document of Playwright is also mentioned here. |
That's good to know, I'll add a link to that on the README. Thanks! |
Updated the readme: 1c5f96e |
Mostly to ensure, that I'm out of options, except migrating to Linux (or using WSL2).
Windows 10, Python 3.8.5, Scrapy 2.4.1, playwright-1.9.2, scrapy-playwright 0.0.3
TL;DR: asyncioEventLoop built on top of SelectorEventLoop, and by design need from there addReader (or maybe something else), and won't work with ProactorEventLoop. But also, subprocesses on windows supported only in ProactorEventLoop, and not implemented in SelectorEventLoop.
The reasons mostly described here: https://docs.python.org/3/library/asyncio-platforms.html#asyncio-windows-subprocess
With
process = CrawlerProcess(get_project_settings())
instarter.py
:In
settings.py
:For Twisted == 20.3.0:
For Twisted-21.2.0:
(writing things below just for easier googling for errors, because of course those actions will not help):
Also, if we try to set for CrawlerProcess in
starter.py
:asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
before installing reactor or just set SelectorEventLoop here:install_reactor('twisted.internet.asyncioreactor.AsyncioSelectorReactor', event_loop_path='asyncio.SelectorEventLoop')
- we will getNotImplementedError
Even if we not using starter script and will start spider from terminal with
scrapy crawl spider_name
withASYNCIO_EVENT_LOOP = "asyncio.SelectorEventLoop"
insettings.py
The text was updated successfully, but these errors were encountered: