Open Jamm7890 opened 1 year ago
When I run this code:
html = await get_html(url, '#content .filter')
I get this error:
Task exception was never retrieved future: <Task finished name='Task-9' coro=<Connection.run() done, defined at C:\Users\J\anaconda3\lib\site-packages\playwright\_impl\_connection.py:240> exception=NotImplementedError()> Traceback (most recent call last): File "C:\Users\J\anaconda3\lib\site-packages\playwright\_impl\_connection.py", line 247, in run await self._transport.connect() File "C:\Users\J\anaconda3\lib\site-packages\playwright\_impl\_transport.py", line 132, in connect raise exc File "C:\Users\J\anaconda3\lib\site-packages\playwright\_impl\_transport.py", line 120, in connect self._proc = await asyncio.create_subprocess_exec( File "C:\Users\J\anaconda3\lib\asyncio\subprocess.py", line 236, in create_subprocess_exec transport, protocol = await loop.subprocess_exec( File "C:\Users\J\anaconda3\lib\asyncio\base_events.py", line 1676, in subprocess_exec transport = await self._make_subprocess_transport( File "C:\Users\J\anaconda3\lib\asyncio\base_events.py", line 498, in _make_subprocess_transport raise NotImplementedError --------------------------------------------------------------------------- NotImplementedError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_16536\3703175856.py in <module> ----> 1 html= await get_html(url,'#content.filter') ~\AppData\Local\Temp\ipykernel_16536\3669287910.py in get_html(url, selector, sleep, retries) 4 time.sleep(sleep * i) 5 try: ----> 6 async with async_playwright() as p: 7 browser = await p.firefox.launch() 8 page = await browser.new_page() ~\anaconda3\lib\site-packages\playwright\async_api\_context_manager.py in __aenter__(self) 44 if not playwright_future.done(): 45 playwright_future.cancel() ---> 46 playwright = AsyncPlaywright(next(iter(done)).result()) 47 playwright.stop = self.__aexit__ # type: ignore 48 return playwright ~\anaconda3\lib\site-packages\playwright\_impl\_connection.py in run(self) 245 self.playwright_future.set_result(await self._root_object.initialize()) 246 --> 247 await self._transport.connect() 248 self._init_task = self._loop.create_task(init()) 249 await self._transport.run() ~\anaconda3\lib\site-packages\playwright\_impl\_transport.py in connect(self) 130 except Exception as exc: 131 self.on_error_future.set_exception(exc) --> 132 raise exc 133 134 self._output = self._proc.stdin ~\anaconda3\lib\site-packages\playwright\_impl\_transport.py in connect(self) 118 env.setdefault("PLAYWRIGHT_BROWSERS_PATH", "0") 119 --> 120 self._proc = await asyncio.create_subprocess_exec( 121 str(self._driver_executable), 122 "run-driver", ~\anaconda3\lib\asyncio\subprocess.py in create_subprocess_exec(program, stdin, stdout, stderr, loop, limit, *args, **kwds) 234 protocol_factory = lambda: SubprocessStreamProtocol(limit=limit, 235 loop=loop) --> 236 transport, protocol = await loop.subprocess_exec( 237 protocol_factory, 238 program, *args, ~\anaconda3\lib\asyncio\base_events.py in subprocess_exec(self, protocol_factory, program, stdin, stdout, stderr, universal_newlines, shell, bufsize, encoding, errors, text, *args, **kwargs) 1674 debug_log = f'execute program {program!r}' 1675 self._log_subprocess(debug_log, stdin, stdout, stderr) -> 1676 transport = await self._make_subprocess_transport( 1677 protocol, popen_args, False, stdin, stdout, stderr, 1678 bufsize, **kwargs) ~\anaconda3\lib\asyncio\base_events.py in _make_subprocess_transport(self, protocol, args, shell, stdin, stdout, stderr, bufsize, extra, **kwargs) 496 extra=None, **kwargs): 497 """Create subprocess transport.""" --> 498 raise NotImplementedError 499 500 def _write_to_self(self): NotImplementedError:
How can I fix this?
When I run this code:
I get this error:
How can I fix this?