Skip to content

Winloop + Playwright -> startupinfo is not supported #34

Open

Description

@rmakowiecki

Hi, first of all thank you for doing this project, it's been massively helpful when running my project on Windows.
My project used to use Selenium 4.12 for automating browser actions, recently I switched up to Playwright.
However, suddenly on Windows I started getting problems. I'm unable to spin up Playwright doe to this crash when Playwright tries to run login in a subprocess:

future: <Task finished name='Task-18' coro=<Connection.run() done, defined at C:\Users\[REDACTED]\venv\Lib\site-packages\playwright\_impl\_connection.py:265> exception=ValueError('startupinfo is not supported')>
Traceback (most recent call last):
  File "C:\Users\[REDACTED]\venv\Lib\site-packages\playwright\_impl\_connection.py", line 272, in run
    await self._transport.connect()
  File "C:\Users\[REDACTED]\venv\Lib\site-packages\playwright\_impl\_transport.py", line 133, in connect
    raise exc
  File "C:\Users\[REDACTED]\venv\Lib\site-packages\playwright\_impl\_transport.py", line 120, in connect
    self._proc = await asyncio.create_subprocess_exec(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python311\Lib\asyncio\subprocess.py", line 223, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "winloop\loop.pyx", line 2832, in subprocess_exec
  File "winloop\loop.pyx", line 2773, in __subprocess_run
ValueError: startupinfo is not supported
Traceback (most recent call last):
  File "C:\Users\[REDACTED]\src\tasks\base_task.py", line 125, in execute
    self.browser_context, self.profile = await provide_browser(self.account_id)
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\[REDACTED]\src\ops\open_browser_session.py", line 118, in open_browser_for_profile
    browser_context = await browser_coro
                      ^^^^^^^^^^^^^^^^^^
  File "C:\Users\[REDACTED]\src\ops\open_browser_session.py", line 98, in get_browser
    playwright = self.__playwright = (await async_playwright().start())
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\[REDACTED]\venv\Lib\site-packages\playwright\async_api\_context_manager.py", line 51, in start
    return await self.__aenter__()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\[REDACTED]\venv\Lib\site-packages\playwright\async_api\_context_manager.py", line 46, in __aenter__
    playwright = AsyncPlaywright(next(iter(done)).result())
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\[REDACTED]\venv\Lib\site-packages\playwright\_impl\_transport.py", line 120, in connect
    self._proc = await asyncio.create_subprocess_exec(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python311\Lib\asyncio\subprocess.py", line 223, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "winloop\loop.pyx", line 2832, in subprocess_exec
  File "winloop\loop.pyx", line 2773, in __subprocess_run
ValueError: startupinfo is not supported
Process SpawnProcess-1:
Traceback (most recent call last):
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
Traceback (most recent call last):
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "winloop\loop.pyx", line 1520, in winloop.loop.Loop.run_until_complete
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python311\Lib\multiprocessing\process.py", line 314, in _bootstrap
    self.run()
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python311\Lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures\process.py", line 249, in _process_worker
    call_item = call_queue.get(block=True)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python311\Lib\multiprocessing\queues.py", line 103, in get
    res = self._recv_bytes()
          ^^^^^^^^^^^^^^^^^^
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python311\Lib\multiprocessing\connection.py", line 216, in recv_bytes
    buf = self._recv_bytes(maxlength)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python311\Lib\multiprocessing\connection.py", line 321, in _recv_bytes
    waitres = _winapi.WaitForMultipleObjects(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
  File "C:\Users\[REDACTED]\venv\Lib\site-packages\winloop\__init__.py", line 63, in wrapper
    return await main
           ^^^^^^^^^^
  File "C:\Users\[REDACTED]\src\main.py", line 31, in main
    await aio.sleep(1)
  File "C:\Users\[REDACTED]\AppData\Local\Programs\Python\Python311\Lib\asyncio\tasks.py", line 649, in sleep
    return await future
           ^^^^^^^^^^^^
asyncio.exceptions.CancelledError

This is how I currently run my main logic loop:

async def main():
    # async operations
    while True:
        await aio.sleep(1)


if __name__ == "__main__":
    if sys.platform in ('win32', 'cygwin', 'cli'):
        import winloop 
        aio.set_event_loop_policy(winloop.EventLoopPolicy())
        winloop.run(main())
    else:
        from uvloop import run
        run(main())

Is there any way this error can be circumvented / fixed / monkey-patched? I would really like to continue using winloop for this project, the speed of execution improvements are uncanny.

Activity

  1. Vizonex commented on Sep 22, 2024

    @Vizonex
    Owner

    @Haydart When it comes to launching a process one of the things I tried to do was that winloop would release the GIL during the initial launch of the process, this was done due to the fact that windows doesn't fork processes and I clearly wanted something that would be it's equal to replace it, perhaps maybe I can look into getting rid of releasing the GIL upon launching the process up first thing and see if it does anything. Otherwise if it isn't our fault after I've made those fixes I would raise this concern to the authors of playwright. I may not be able to fix it right away however due to me being busy with work. But in the meantime Let me give this some careful thinking and consideration. However I also believe that this could be winapi's fault and not my own code that I've written over a year ago. Again glad you brought this issue up for me and the rest of us.

  2. added
    bugSomething isn't working
    help wantedExtra attention is needed
    on Sep 22, 2024
  3. Vizonex commented on Sep 22, 2024

    @Vizonex
    Owner

    @Haydart I'll also see if me or someone else would be willing to write a unittest for playwright specifically to see if that does anything so that this webdriver is supported more in the future.

  4. pinned this issue on Sep 22, 2024
  5. Vizonex commented on Sep 25, 2024

    @Vizonex
    Owner

    @Haydart I added playwright as part of the testsuite now so hopefully me or one of the other contributors will be able to work on what's causing your problems now.

  6. unpinned this issue on Nov 29, 2024
  7. Vizonex commented on Jul 29, 2025

    @Vizonex
    Owner

    @Haydart I apologize for adding a wont-fix label. Unfortunately I don't know when I will get to this one since it's always laid dormant and knowing how Microsoft is (especially when talking about telemetry) playwright just has never sat right with me even after using pyppeteer for the majority of my things if I ever chosen to automate a webbrowser for the purpose of webscraping a javascript-heavy site. This however is my opinion and mine alone. However I can always remove this label in the future since I thought about testing winloop without releasing the gil around when a process is to be launched. I always found it disappointing that Microsoft can't embrace forking. But who knows maybe things will change in the future to allow for that. I will leave this issue open however since I think some contributor who might be more obligated than I am will want to do it and I've seen them come and go. I've always been open to new ideas even if I don't like it.

  8. Vizonex commented on Dec 7, 2025

    @Vizonex
    Owner

    @Haydart Probably works now since I patched a few bugs with sub processes now but if this is not the case I would label playwright as being at fault.

  9. self-assigned this
    on Dec 7, 2025
  10. added
    external library's faultexternal library is to blame for the problem and is not a bug in with winloop itself
    and removed
    wontfixThis will not be worked on
    on Dec 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingexternal library's faultexternal library is to blame for the problem and is not a bug in with winloop itselfhelp wantedExtra attention is needed

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions