0

I created a script and turn it into an .exe file using pyinstaller but was unable to run the .exe without encountering the following error:

*Traceback (most recent call last):
  File "main.py", line 31, in <module>
  File "playwright\sync_api\_generated.py", line 11436, in launch
  File "playwright\_impl\_sync_base.py", line 111, in _sync
  File "playwright\_impl\_browser_type.py", line 90, in launch
  File "playwright\_impl\_connection.py", line 39, in send
  File "playwright\_impl\_connection.py", line 63, in inner_send
playwright._impl._api_types.Error: Executable doesn't exist at C:\(...)\chrome.exe*

╔═════════════════════════════════════════════════════════════════════════╗
║ Looks like Playwright Test or Playwright was just installed or updated. ║
║ Please run the following command to download new browsers:              ║
║                                                                         ║
║     playwright install                                                  ║
║                                                                         ║
║ <3 Playwright Team                                                      ║
╚═════════════════════════════════════════════════════════════════════════╝
[9084] Failed to execute script 'main' due to unhandled exception!

I have already installed playwright on my computer.

enter image description here

How do I fix this?

4 Answers 4

1

You need to install browsers by doing playwright install or python -m playwright install see here: https://playwright.dev/python/docs/intro#installation

Sign up to request clarification or add additional context in comments.

2 Comments

I've already ran the command on my computer. But the script only works when I ran it for my IDE but gives this issue on my .exe Is there a way I can trigger this command when someone double clicks on my .exe file?
0

It is necessary to install the browser that will be used by playwright first. To do this, type in bash:

PLAYWRIGHT_BROWSERS_PATH=0 playwright install chromium
pyinstaller -F main.py

Comments

0

I had the same problem. This guide explains how to create an .exe file using Playwright https://medium.com/@animeshsingh161/how-to-convert-a-python-playwright-script-into-an-executable-app-playwright-with-python-b61d8ff0ca64 using an venv; however, as a Windows user is important to add the keyword set on the terminal on step 3 (set PLAYWRIGHT_BROWSERS_PATH=0 playwright install browser), where browser is the browser that you are using, for example, set PLAYWRIGHT_BROWSERS_PATH=0 playwright install firefox. The browser is optional, but, if you type it, it is going to save you space.

Comments

0

For me, the solution that worked was to activate my virtual environment and run playwright install. This creates a folder named 0 playwright inst. This folder contains the missing file needed for your program.

"Executable doesn't exist at C:(...)\chrome.exe*" <- Take the directory path from this error message. Then, move the "chromium-1117" folder into the directory specified in the error message. This worked for me.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.