Skip to content
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

[BUG] AttributeError: 'PlaywrightContextManager' object has no attribute '_playwright' #1565

Closed
mborsetti opened this issue Sep 25, 2022 · 5 comments · Fixed by microsoft/playwright#17579
Assignees

Comments

@mborsetti
Copy link

Context:

  • Playwright Version: 1.26.0
  • Operating System: Windows 11 Pro version 10.0.22000 Build 22000
  • Python version: 3.10.7
  • Browser: Google Chrome 105.0.5195.127 (Official Build) (64-bit)
  • Extra: node v18.9.1

Code Snippet

Help us help you! Put down a short code snippet that illustrates your bug and
that we can run and debug locally.

>>> from playwright.sync_api import sync_playwright
>>> with sync_playwright() as p:
...     browser = p.chromium.launch(channel='chrome')
...
'""C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python\Python310\lib\site-packages\playwright\sync_api\_context_manager.py", line 89, in __enter__
    playwright = self._playwright
AttributeError: 'PlaywrightContextManager' object has no attribute '_playwright'
>>>

Describe the bug

AttributeError: 'PlaywrightContextManager' object has no attribute '_playwright'

Add any other details about the problem here.

Also weird output

'""C:\Program' is not recognized as an internal or external command,
operable program or batch file.
@mborsetti
Copy link
Author

Any suggestion as to how one can install the new, fixed, code, to resuscitate Playwright?

Neither building from GitHub by running pip install git+https://github.com/microsoft/playwright-python@main nor reverting to a prior version with pip install playwright<1.26 yields a working version of Playwright. It appears that the fix has been applied to on an unreleased npm dependency of playwright-python, and I don't know how to install that code, which contains the unreleased fix. As a result, Playwright is still bricked on Windows.

@mxschmitt
Copy link
Member

You can either continue to use 1.25 for a few days or wait for 1.26.1 which we'll publish in a few days.

@mxschmitt mxschmitt reopened this Sep 27, 2022
@mxschmitt mxschmitt added v1.26 and removed v1.27 labels Sep 27, 2022
@mborsetti
Copy link
Author

mborsetti commented Sep 27, 2022

Apologies.

For some reason pip install playwright==1.25.2 did not yield the correct results the first time around. It indeed works.

@rwoll rwoll closed this as completed Sep 28, 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

Successfully merging a pull request may close this issue.

3 participants