question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When redistributing python exe, seleniumwire ca.crt not found in temp folder

See original GitHub issue

On the machine that I coded on, the chrome browser opens by selenium using the chromedriver. When I convert code to .exe it still runs the same as it would in the IDE.

When I use the .exe on another machine which still has python installed but not selenium/wire, then it runs into this problem when trying to open.

[Errno 2] No such file or directory: 'C:\\Users\\Owner\\AppData\\Local\\Temp\\_MEI123722\\seleniumwire\\ca.crt'

After manually putting the certificate (ca.crt) into the folder and run again, I get this problem. Note that I’m using a tkinter button to start the browser so that’s why the _MEI123722 doesn’t change. If I did reload the program then it changes to something like _MEI123801

[Errno 2] No such file or directory: 'C:\\Users\\Owner\\AppData\\Local\\Temp\\_MEI123722\\seleniumwire\\ca.key'

How can I fix this so I can make my software distributable.

I’m running Windows on both machines, using python 3.9(64).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:30 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
wkeelingcommented, Jul 27, 2022

[Errno 2] No such file or directory: 'C:\\Users\\Owner\\AppData\\Local\\Temp\\_MEI123722\\seleniumwire\\ca.key' How can I fix this so I can make my software distributable.

To resolve this error it’s necessary to tell pyinstaller about the two certificate files using the --add-data option when you compile the binary. This allows pyinstaller to handle the calls made by Selenium Wire when Selenium Wire first loads the certificates. (Selenium Wire uses the standard mechanism of pkgutil.get_data() to load these files internally.)

Steps:

  • Create the two certificate files ca.crt and ca.key in the current working directory.
  • Specify these files using --add-data when you run pyinstaller - for example:
pyinstaller --add-data 'ca.crt;seleniumwire' --add-data 'ca.key;seleniumwire' --onefile my_prog.py

(where my_prog.py is the name of your script - change as appropriate.)

You can discard the two local certificate files once the binary has been built.

If running on Mac/Linux, use a : for the separator, e.g. --add-data 'ca.crt:seleniumwire'

3reactions
mynoob2commented, Oct 14, 2022

Solved the issue lol. The proper script for windows is pyinstaller --add-data ca.crt;seleniumwire --add-data ca.key;seleniumwire --onefile does not work with the ’ added

Read more comments on GitHub >

github_iconTop Results From Across the Web

No such file or directory "\\seleniumwire\\ca.crt" - Stack Overflow
I've created a python exe file.
Read more >
When redistributing python exe, seleniumwire ca ... - bytemeta
When redistributing python exe, seleniumwire ca.crt not found in temp folder #402. On the machine that I coded on, the chrome browser opens...
Read more >
No such file or directory seleniumwireca.crt - Anycodings.com
Now on this script anycodings_python it makes it fail. How can I remove this so anycodings_python selenium/seleniumwire doesn't use ca.crt.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found