[Bug]: AttributeError: 'PlaywrightContextManager' object has no attribute '_playwright'

See original GitHub issue

Playwright version

1.16.1

Operating system

Windows 10

What browsers are you seeing the problem on?

No response

Other information

python 3.10.0

What happened? / Describe the bug

I see AttributeError sometimes when I run playwright.

Code snippet to reproduce your bug

from playwright.sync_api import sync_playwright

for i in range(10000):
    print(i)
    with sync_playwright() as p:
        pass

Relevant log output

Traceback (most recent call last):
  File "...\scratches\scratch_1.py", line 4, in <module>
    print(i)
  File "...\venv\lib\site-packages\playwright\sync_api\_context_manager.py", line 71, in __enter__
    playwright = self._playwright
AttributeError: 'PlaywrightContextManager' object has no attribute '_playwright'

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:21 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
KotlinIslandcommented, Dec 27, 2021

Closing since Playwright does not support Windows 7 or Windows Server 2008. Both versions are end of life and not supported anymore (security updates by Microsoft as well).

@mxschmitt The op was windows 10, not 7

1reaction
phoenixorcommented, Nov 25, 2021

i followed the official example

from playwright.sync_api import sync_playwright
with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page()
    page.goto("http://playwright.dev")
    print(page.title())
    browser.close()

and i got this bug:

Node.js is only supported on Windows 8.1, Windows Server 2012 R2, or higher.
Setting the NODE_SKIP_PLATFORM_CHECK environment variable to 1 skips this
check, but Node.js might not execute correctly. Any issues encountered on
unsupported platforms will not be fixed.Traceback (most recent call last):

AttributeError: 'PlaywrightContextManager' object has no attribute '_playwright'
Task was destroyed but it is pending!
task: <Task pending name='Task-3' coro=<Connection.run.<locals>.init() running at D:\python\py_projects\police_helper\.venv\lib\site-packages\playwright\_impl\_connection.py:179> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x0000000002678B20>()]>>

platform: windows 7 nodejs v13.14.0 playwright python 1.17.0 python 3.8.10

Read more comments on GitHub >

github_iconTop Results From Across the Web

attributeerror: 'playwrightcontextmanager' object ... - You.com
I see AttributeError sometimes when I run playwright. Code snippet to reproduce your bug. shell from playwright ...
Read more >
Run playwright in interactive mode in Python - Stack Overflow
I know how to do the same using a script, but I was trying this in an interactive mode. from playwright.sync_api import Playwright, ......
Read more >
scrapy-playwright - PyPI
A Scrapy Download Handler which performs requests using Playwright for Python. It can be used to handle pages that require JavaScript (among other...
Read more >
AttributeError: 'PlaywrightContextManager' object has ... - 博客园
1.问题分析1.1. 公司云桌面win7系统把之前C盘中自带的py3.7环境给还原了,之前跑得好好的PlayWright案例不能运行了2.解决过程2.1. 参考网上的解决方案 ...
Read more >
Automate web browsers with Python and Playwright
Using Playwright to control Chromium, Firefox, or WebKit with Python ... are mostly the same except how you access the Playwright object.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found