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

Jupyter support for BrowserSession #3

Closed
kenster89 opened this issue Sep 1, 2023 · 2 comments
Closed

Jupyter support for BrowserSession #3

kenster89 opened this issue Sep 1, 2023 · 2 comments
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@kenster89
Copy link

On Windows 10, Python 3.10.1:

import hrequests
page = hrequests.BrowserSession()

Results in the follow exception:

Task exception was never retrieved
future: <Task finished name='Task-7' coro=<Connection.run() done, defined at <redacted>\hrequests\venv\lib\site-packages\playwright\_impl\_connection.py:264> exception=NotImplementedError()>
Traceback (most recent call last):
  File "<redacted>\hrequests\venv\lib\site-packages\playwright\_impl\_connection.py", line 271, in run
    await self._transport.connect()
  File "<redacted>\hrequests\venv\lib\site-packages\playwright\_impl\_transport.py", line 127, in connect
    raise exc
  File "<redacted>\hrequests\venv\lib\site-packages\playwright\_impl\_transport.py", line 116, in connect
    self._proc = await asyncio.create_subprocess_exec(
  File "C:\Users\<redacted>\AppData\Local\Programs\Python\Python310\lib\asyncio\subprocess.py", line 218, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
  File "C:\Users\<redacted>\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1652, in subprocess_exec
    transport = await self._make_subprocess_transport(
  File "C:\Users\<redacted>\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 493, in _make_subprocess_transport
    raise NotImplementedError
NotImplementedError
Exception in thread Thread-5 (spawn_main):
Traceback (most recent call last):
  File "C:\Users\<redacted>\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Users\<redacted>\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "<redacted>\hrequests\venv\lib\site-packages\hrequests\browser.py", line 115, in spawn_main
    asyncio.new_event_loop().run_until_complete(self.main())
  File "C:\Users\<redacted>\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 641, in run_until_complete
    return future.result()
  File "<redacted>\hrequests\venv\lib\site-packages\hrequests\browser.py", line 119, in main
    self.client = await hrequests.PlaywrightMock(
  File "<redacted>\hrequests\venv\lib\site-packages\async_class.py", line 173, in __await__
    yield from self.create_task(
  File "<redacted>\hrequests\venv\lib\site-packages\hrequests\playwright_mock\playwright_mock.py", line 19, in __ainit__
    self.playwright = await async_playwright().start()
  File "<redacted>\hrequests\venv\lib\site-packages\playwright\async_api\_context_manager.py", line 52, in start
    return await self.__aenter__()
  File "<redacted>\hrequests\venv\lib\site-packages\playwright\async_api\_context_manager.py", line 47, in __aenter__
    playwright = AsyncPlaywright(next(iter(done)).result())
  File "<redacted>\hrequests\venv\lib\site-packages\playwright\_impl\_connection.py", line 271, in run
    await self._transport.connect()
  File "<redacted>\hrequests\venv\lib\site-packages\playwright\_impl\_transport.py", line 127, in connect
    raise exc
  File "<redacted>\hrequests\venv\lib\site-packages\playwright\_impl\_transport.py", line 116, in connect
    self._proc = await asyncio.create_subprocess_exec(
  File "C:\Users\<redacted>\AppData\Local\Programs\Python\Python310\lib\asyncio\subprocess.py", line 218, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
  File "C:\Users\<redacted>\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1652, in subprocess_exec
    transport = await self._make_subprocess_transport(
  File "C:\Users\<redacted>\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 493, in _make_subprocess_transport
    raise NotImplementedError
NotImplementedError
@daijro
Copy link
Owner

daijro commented Sep 1, 2023

Hello,
This seems to be an issue with Playwright's async API.

By any chance, are you running this in a Jupyter notebook? I was able to reproduce this error in there. Unfortunately, it doesn't look like Jupyter support can be fixed. (See here)

@kenster89
Copy link
Author

Ok. Yes I was running this from a notebook.

@daijro daijro closed this as completed Sep 1, 2023
@daijro daijro changed the title BrowserSession() NotImplementedError on Windows Jupyter support for BrowserSession Sep 1, 2023
@daijro daijro added the wontfix This will not be worked on label Sep 1, 2023
@daijro daijro added the bug Something isn't working label Sep 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants