Skip to content

Commit b4fa615

Browse files
committed
Update readme about Windows
1 parent aaf5f43 commit b4fa615

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

README.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,21 @@ does not match the running Browser. If you prefer the `User-Agent` sent by
112112
default by the specific browser you're using, set the Scrapy user agent to `None`.
113113

114114

115+
## Windows support
116+
117+
Windows support is possible by running the Playwright process in a `ProactorEventLoop`
118+
in a separate execution thread.
119+
This is necessary because it's not possible to run the Playwright process in the same
120+
asyncio event loop as the crawler process:
121+
* Playwright runs the driver in a subprocess. Source:
122+
[Playwright repository](https://github.com/microsoft/playwright-python/blob/v1.44.0/playwright/_impl/_transport.py#L120-L130).
123+
* "On Windows, the default event loop `ProactorEventLoop` supports subprocesses,
124+
whereas `SelectorEventLoop` does not". Source:
125+
[Python docs](https://docs.python.org/3/library/asyncio-platforms.html#asyncio-windows-subprocess).
126+
* Twisted's `asyncio` reactor requires the `SelectorEventLoop`. Source:
127+
[Twisted repository](https://github.com/twisted/twisted/blob/twisted-24.3.0/src/twisted/internet/asyncioreactor.py#L31)
128+
129+
115130
## Supported [settings](https://docs.scrapy.org/en/latest/topics/settings.html)
116131

117132
### `PLAYWRIGHT_BROWSER_TYPE`
@@ -851,6 +866,12 @@ Refer to the
851866
[upstream docs](https://docs.scrapy.org/en/latest/topics/extensions.html#module-scrapy.extensions.memusage)
852867
for more information about supported settings.
853868

869+
### Windows support
870+
871+
Just like the [upstream Scrapy extension](https://docs.scrapy.org/en/latest/topics/extensions.html#module-scrapy.extensions.memusage), this custom memory extension does not work
872+
on Windows. This is because the stdlib [`resource`](https://docs.python.org/3/library/resource.html)
873+
module is not available.
874+
854875

855876
## Examples
856877

@@ -912,23 +933,6 @@ See the [examples](examples) directory for more.
912933

913934
## Known issues
914935

915-
### Lack of native support for Windows
916-
917-
This package does not work natively on Windows. This is because:
918-
919-
* Playwright runs the driver in a subprocess. Source:
920-
[Playwright repository](https://github.com/microsoft/playwright-python/blob/v1.28.0/playwright/_impl/_transport.py#L120-L129).
921-
* "On Windows, the default event loop `ProactorEventLoop` supports subprocesses,
922-
whereas `SelectorEventLoop` does not". Source:
923-
[Python docs](https://docs.python.org/3/library/asyncio-platforms.html#asyncio-windows-subprocess).
924-
* Twisted's `asyncio` reactor requires the `SelectorEventLoop`. Source:
925-
[Twisted repository](https://github.com/twisted/twisted/blob/twisted-22.4.0/src/twisted/internet/asyncioreactor.py#L31).
926-
927-
Some users have reported having success
928-
[running under WSL](https://github.com/scrapy-plugins/scrapy-playwright/issues/7#issuecomment-817394494).
929-
See also [#78](https://github.com/scrapy-plugins/scrapy-playwright/issues/78)
930-
for information about working in headful mode under WSL.
931-
932936
### No per-request proxy support
933937
Specifying a proxy via the `proxy` Request meta key is not supported.
934938
Refer to the [Proxy support](#proxy-support) section for more information.

0 commit comments

Comments
 (0)