Forums

Setting up/Installing playwright on pythonanywhere?

If the problem is about permissions, can I make a ticket to have the access required?

thanks.

some logs for context:

20:16 ~/linecontact (main)$ python -m playwright install

Downloading Chromium 115.0.5790.24 (playwright build v1067) from https://playwright.azureedge.net/builds/chromium/1067/chromium-linux.zip 146.4 Mb [====================] 100% 0.0s Failed to install browsers Error: Failed to download Chromium 115.0.5790.24 (playwright build v1067), caused by Error: Unknown system error -122: Unknown system error -122, write 20:16 ~/linecontact (main)$

My guess would be that either you're hitting a disk quota limit (free accounts have only 512MiB disk, which is unlikely to be enough for chromium) or an allowlist issue (free accounts can only access sites on this list. The Internet access limitations would probably make playwright of limited value anyway, so I would recommend you check how much disk space a local install of it uses, then upgrade to a paid account -- say, a hacker one but with extra disk space if the 1GiB that that plan has by default isn't enough.

.

[Error: Unknown system error -122: Unknown system error -122, write] {
  errno: -122,
  code: 'Unknown system error -122',
  syscall: 'write'
}
(node:64) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead
(Use `node --trace-deprecation ...` to show where the warning was created)
Downloading Chromium 120.0.6099.28 (playwright build v1091) from https://playwright-akamai.azureedge.net/builds/chromium/1091/chromium-linux.zip
Error [ERR_SOCKET_CLOSED]: Socket is closed
    at new NodeError (node:internal/errors:406:5)
    at Socket._writeGeneric (node:net:942:8)
    at Socket._write (node:net:964:8)
    at doWrite (node:internal/streams/writable:465:12)
    at clearBuffer (node:internal/streams/writable:625:7)
    at Writable.uncork (node:internal/streams/writable:407:7)
    at ClientRequest._flushOutput (node:_http_outgoing:1151:10)
    at ClientRequest._flush (node:_http_outgoing:1120:22)
    at onSocketNT (node:_http_client:898:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'ERR_SOCKET_CLOSED'
}
Downloading Chromium 120.0.6099.28 (playwright build v1091) from https://playwright-verizon.azureedge.net/builds/chromium/1091/chromium-linux.zip
Error [ERR_SOCKET_CLOSED]: Socket is closed
    at new NodeError (node:internal/errors:406:5)
    at Socket._writeGeneric (node:net:942:8)
    at Socket._write (node:net:964:8)
    at doWrite (node:internal/streams/writable:465:12)
    at clearBuffer (node:internal/streams/writable:625:7)
    at Writable.uncork (node:internal/streams/writable:407:7)
    at ClientRequest._flushOutput (node:_http_outgoing:1151:10)
    at ClientRequest._flush (node:_http_outgoing:1120:22)
    at onSocketNT (node:_http_client:898:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'ERR_SOCKET_CLOSED'
}
Failed to install browsers
Error: Failed to download Chromium 120.0.6099.28 (playwright build v1091), caused by
Error: Download failure, code=1
    at ChildProcess.<anonymous> (/home/yahya728/.local/lib/python3.10/site-packages/playwright/driver/package/lib/server/registry/browserFetcher.js:91:16)
    at ChildProcess.emit (node:events:514:28)
    at ChildProcess._handle.onexit (node:internal/child_process:294:12)
11:19 ~ $

[edit by admin: formatting]

In a free account, you're probably not going to be able to download the latest version of Chromium for your playwright code, both due to the restricted Internet access that free accounts have, and I suspect due to the limited disk space too. Also, you won't be able to do much in the way of web-scraping, because the Internet access for free accounts is limited to our allowlist of official public APIs.