Missing file in compiled py2exe app selenium

后端 未结 2 1173
日久生厌
日久生厌 2021-01-22 22:34

I am trying to get my Selenium app to work. It compiles everything, but when I open the app it gives me this:

C:\\Python34\\dist>browse.exe
Traceback (most re         


        
相关标签:
2条回答
  • 2021-01-22 23:03

    This worked: Edit firefox_profile.py: WEBDRIVER_EXT, WEBDRIVER_PREFERENCES:

    if getattr(sys, 'frozen', False): WEBDRIVER_EXT = os.path.join(os.path.dirname(sys.executable), "webdriver.xpi") WEBDRIVER_PREFERENCES = os.path.join(os.path.dirname(sys.executable), "webdriver_prefs.json") elif file: WEBDRIVER_EXT = os.path.join(os.path.dirname(file), "webdriver.xpi") WEBDRIVER_PREFERENCES = os.path.join(os.path.dirname(file), "webdriver_prefs.json")

    goto the line "with open(...." and replace with "with open(WEBDRIVER_PREFERENCES) as default_prefs"

    0 讨论(0)
  • Check the original answer: Python - Trouble in building executable

    You have to manually copy both webdriver.xpi and webdriver_prefs.json from C:\Python27\Lib\site-packages\selenium\webdriver\firefox to dist\selenium\webdriver\firefox

    0 讨论(0)
提交回复
热议问题