Why can't I run playwright in python but I can in VSCode?

I have no problem running a scraper in python with playwright and selectolax in VSCode, but haven’t figured out why I can’t run it in Replit. Any thoughts?

Traceback (most recent call last):
  File "main.py", line 141, in <module>
    main()
  File "main.py", line 77, in main
    with sync_playwright() as pw:
  File "/home/runner/REAgentScrapperer/venv/lib/python3.10/site-packages/playwright/sync_api/_context_manager.py", line 88, in __enter__
    dispatcher_fiber.switch()
  File "/home/runner/REAgentScrapperer/venv/lib/python3.10/site-packages/playwright/sync_api/_context_manager.py", line 67, in greenlet_main
    self._loop.run_until_complete(self._connection.run_as_sync())
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/runner/REAgentScrapperer/venv/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 238, in run_as_sync
    await self.run()
  File "/home/runner/REAgentScrapperer/venv/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 247, in run
    await self._transport.connect()
  File "/home/runner/REAgentScrapperer/venv/lib/python3.10/site-packages/playwright/_impl/_transport.py", line 132, in connect
    raise exc
  File "/home/runner/REAgentScrapperer/venv/lib/python3.10/site-packages/playwright/_impl/_transport.py", line 120, in connect
    self._proc = await asyncio.create_subprocess_exec(
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/asyncio/subprocess.py", line 218, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/asyncio/base_events.py", line 1670, in subprocess_exec
    transport = await self._make_subprocess_transport(
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/asyncio/unix_events.py", line 207, in _make_subprocess_transport
    transp = _UnixSubprocessTransport(self, protocol, args, shell,
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/asyncio/base_subprocess.py", line 36, in __init__
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/asyncio/unix_events.py", line 800, in _start
    self._proc = subprocess.Popen(
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/nix/store/hd4cc9rh83j291r5539hkf6qd8lgiikb-python3-3.10.8/lib/python3.10/subprocess.py", line 1847, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/home/runner/REAgentScrapperer/venv/lib/python3.10/site-packages/playwright/driver/playwright.sh'
1 Like

Welcome to the community, @redpiratesea!

It would be useful if you could send a link to your Repl.

1 Like

Sure thing, this was the start of it

https://replit.com/@redpiratesea/REAgentScrapperer#main.py

1 Like

Hey @redpiratesea!

Thank you for reporting this. I was able to reproduce this and have sent this to the team. I will reply here on the ticket status once I have an update!

1 Like

Thanks - btw you should include the ask subdomain as a page on the main replit page. There’s a community page, a help page, and this ask forum. it’s not very easy to navigate here,

1 Like

We are working on that too!

2 Likes

I am encountering the same issue - any idea how to solve this?

1 Like

try after running in shell

chmod 777 /home/runner/REAgentScrapperer/venv/lib/python3.10/site-packages/playwright/driver/playwright.sh
2 Likes

I get this error after running the suggested command in shell:

Traceback (most recent call last):
  File "main.py", line 128, in <module>
    with sync_playwright() as playwright:
  File "/home/runner/LazyWellgroomedCygwin/venv/lib/python3.10/site-packages/playwright/sync_api/_context_manager.py", line 90, in __enter__
    playwright = self._playwright
AttributeError: 'PlaywrightContextManager' object has no attribute '_playwright'