Skip to content

NotImplementedError on Windows when running Playwright in asyncio with Python 3.11 #3012

@adnanbaigkairos

Description

@adnanbaigkairos

Code:

import asyncio
import `sys`
from fastapi import FastAPI

if sys.platform == 'win32':
    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

from skyvern import Skyvern

app = FastAPI()
prompt = """Prompt here"""

@app.get("/analyze-website")
async def analyze_website():
    skyvern = Skyvern()
    response = await skyvern.run_task(prompt=prompt)
    return {"response": response}


if __name__ == "__main__":
    import uvicorn
    uvicorn.run("test:app", host="127.0.0.1", port=6776)

When trying to run a Playwright-based async task in our Skyvern project on Windows 10 with Python 3.11, the task fails with the following error:
File "asyncio\base_events.py", line 502, in _make_subprocess_transport
raise NotImplementedError

Environment:
OS: Windows 11
Python: 3.11
Playwright: Latest version installed via pip
Project: Skyvern running local using Gemini LLM (setup in .env)
Run Command: python test.py / uvicorn test:app

Expected Behavior:
Playwright should initialize the browser instance as expected without throwing an error.

Observed Behavior:
Fails with NotImplementedError during the async Playwright initialization.

Solution tried but NOT solved the issue:

import sys
import asyncio

if sys.platform == 'win32':
    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

Please fixed this issue as soon as possible and provide the no error/issue solution

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions