Py2exe isn't copying webdriver_prefs.json into builds

前端 未结 4 572
小蘑菇
小蘑菇 2020-12-21 10:54

I\'m using py2exe to compile a Python 2.7 script that uses Selenium 2.39.0 to open up Firefox windows and carry out some routines. In the past, I\'ve been able to compile th

4条回答
  •  一向
    一向 (楼主)
    2020-12-21 11:01

    I did the following to fix the problem:

    1. Create a sub-folder \selenium\webdriver\firefox\ under dist.
    2. Under command DOS prompt, enter python.exe setup_firefox.py
    3. You could either running the executable under dist or copy all the files under "dist" to your own directory and run the executable from there.

    Here is my setup_firefox.py:

    from distutils.core import setup
    import py2exe,sys,os
    
    sys.argv.append('py2exe')
    
    setup(
        console=[{'script':"test.py"}],
        options={
            "py2exe":{
                    "skip_archive": True,
                    "unbuffered": True,
                    "optimize": 2
            },
        }
    )
    

提交回复
热议问题