Rayrun
← Back to Discord Forum

Greenlet module not found

Hello, I just have discovered Playwright and wanted to run a simple test, basically, open a page on twich. Here is the code I used: from playwright.sync_api import sync_playwright with sync_playwright() as pw: browser = pw.chromium.launch(headless=False) context = browser.new_context(viewport={"width": 1920, "height": 1080}) page = context.new_page()

page.goto("https://twitch.tv/directory/game/Art")
page.wait_for_selector("div[data-target=directory-first-item]")
print(page.content())

Unfortunately, it fails on line #1 with the error: ModuleNotFoundError: No module named 'greenlet._greenlet'

I work on win10, python 3.11. 64bits, playwright v 1.33.0 and greenlet 2.0.1. Can somebody help me with this error?

This thread is trying to answer question "How to solve the ModuleNotFoundError related to the greenlet module when trying to run a simple test with Playwright?"

5 replies
bandito9274
bandito9274

Hi, what do you have on top of the code? Import for example

refactoreric

Hmm greenlet is about threading? Playwright API is not thread safe: https://playwright.dev/python/docs/library#threading

Don't know if it has anything to do with the error though.

@bandito9274 : I have provided all the code.

I think the problem was coming from how I installed playwright. I first use "pip install playright", then "playwright chrome firefox". I uninstalled playwright and reinstalled it the same way but using "playwrite install" and no more error occured with the same code. Sorry I should have tried this before asking here.

@bandi @refactoreric thanks for you help

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].