[Python] ERROR:"It looks like you are using Playwright Sync API inside the asyncio loop....

Discussão em 'Python' iniciado por Stack, Janeiro 10, 2025.

  1. Stack

    Stack Membro Participativo

    I have this setup

    File 1

    from playwright.sync_api import sync_playwright


    class A:
    def __init__(self,login_dict):
    self.start = sync_playwright().start()
    self.browser = self.start.chromium.launch()
    self.context = self.browser.new_context()
    self.page = self.context.new_page()
    self.login_dict = login_dict


    File 2

    import file_1.py

    class B(A):
    def __init__(self):
    super().__init__()



    from file_1 import A
    from file_2 import B

    a = A(some_login_dict)
    b = B()



    I get this error at the super init of B class

    It looks like you are using Playwright Sync API inside the asyncio loop. Please use the Async API instead.

    I do not understand why is this happening, can someone explain? Is there a way to avoid this?

    Continue reading...

Compartilhe esta Página