From 2b082b76e9e1640485e7c2a83d0f1ebbd0b3bccc Mon Sep 17 00:00:00 2001 From: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Date: Fri, 10 Sep 2021 12:54:54 +0530 Subject: [PATCH 1/2] docs(python): add docs about threading --- docs/src/intro-python.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/src/intro-python.md b/docs/src/intro-python.md index fcb34d6264555..9a1d5c09f830b 100644 --- a/docs/src/intro-python.md +++ b/docs/src/intro-python.md @@ -189,6 +189,11 @@ Playwright runs the driver in a subprocess, so it requires `ProactorEventLoop` o On Windows Python 3.7, Playwright sets the default event loop to `ProactorEventLoop` as it is default on Python 3.8+. +### Threading and Playwright Sync API are incompatible + +Playwright's Sync API is not thread-safe. If you are using Playwright in a multi-threaded environment, you should create a playwright instance per thread. See [threading issue](https://github.com/microsoft/playwright-python/issues/623) for more details. + + ## System requirements Playwright requires Python 3.7 or above. The browser binaries for Chromium, From e8b8232599950eae23007e515793725ae7df67a8 Mon Sep 17 00:00:00 2001 From: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Date: Mon, 27 Sep 2021 15:51:11 +0530 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Max Schmitt --- docs/src/intro-python.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/intro-python.md b/docs/src/intro-python.md index 9a1d5c09f830b..7c9fc94dec040 100644 --- a/docs/src/intro-python.md +++ b/docs/src/intro-python.md @@ -189,9 +189,9 @@ Playwright runs the driver in a subprocess, so it requires `ProactorEventLoop` o On Windows Python 3.7, Playwright sets the default event loop to `ProactorEventLoop` as it is default on Python 3.8+. -### Threading and Playwright Sync API are incompatible +### Threading -Playwright's Sync API is not thread-safe. If you are using Playwright in a multi-threaded environment, you should create a playwright instance per thread. See [threading issue](https://github.com/microsoft/playwright-python/issues/623) for more details. +Playwright's API is not thread-safe. If you are using Playwright in a multi-threaded environment, you should create a playwright instance per thread. See [threading issue](https://github.com/microsoft/playwright-python/issues/623) for more details. ## System requirements