0

I have a python script created with selenium wire and wxpython. The script runs fine on my computer and another co-worker's computer(who also has python installed). The idea for this app is to be able to work on other's computers without having to install anything else(if possible).

Script:

import wx
#PyProvider imports browser factory for choosing browser
from PyProvider import * 

    def __init__(self):
        super().__init__(parent=None, title='Interceptor')
        wx.Frame.__init__(self, None)
        panel = wx.Panel(self)
        self.Show()

        self.StartBtn = wx.Button(panel, -1, "Start", pos=(3, 10))
        self.StartBtn.Bind(wx.EVT_BUTTON,self.StartClicked) 

        self.driver = BrowserFactory("Chrome", False)

        print("App Running")

    def StartClicked(self, event):
        self.driver.get('https://google.com')


if __name__ == '__main__':
    app = wx.App()
    frame = MyFrame()
    app.MainLoop()

I then used pyinstaller to compile into an exe:

pyinstaller --onefile main.py

Everything runs and works great on my computer.

When I try to run the exe on someone else's computer(no python or anything installed) they were getting an error about a missing certificate(ca.crt). Which i fixed following instructions on this thread:

https://github.com/wkeeling/selenium-wire/issues/402

What I did from this thread was go to C:\Users\USER\AppData\Local\Temp.seleniumwire and made a cert and key file using the certificate & key contained in the file "seleniumwire-ca.pem". I then added these two files to where my script was and ran:

pyinstaller --add-data ca.crt;seleniumwire --add-data ca.key;seleniumwire --onefile main.py

This solved the certificate issue, but now when they run it, it shows this error

OpenSSL.crypto.Error:[]

I updated seleniumwire and tried installing pyOpenSSL as well, still same issue.

Sorry for the bad screenshot(it was from a video taken of the error) but that contains the stack trace showing it has to do with selenium-wire. I cant find any information about it online and have no idea how to fix it(I am really new to python)Stack Trace

Isaac M
  • 56
  • 4
  • My mistake was due to separating the certificate and key and so seleniumwire-ca.pem only contained the certificate and not the private key. If you are having ca.crt issue when using pyinstaller to make a seleniumwire application, go to the temp folder "C:\Users\USER\AppData\Local\Temp\.seleniumwire" and copy the CONTENTS seleniumwire-ca.pem into your working directory into two files: ca.crt and ca.key and run: ```pyinstaller --add-data ca.crt;seleniumwire --add-data ca.key;seleniumwire --onefile filename.py``` This way the pyinstaller sends the full cert and key and no more issues. – – Isaac M Nov 10 '22 at 22:31

0 Answers0