0

I am trying to generate an executable file of a python script using Selenium except when running my setup script I receive an error:

can't copy 'C:\Python27\Lib\site-packages\selenium\webdrive\firefox\webdriver.xpi': 
doesn't exist or not a regular file

I am able to generate an executable that does not require selenium and I know that my selenium works if I run the code through python. Here is my setup.py code:

from distutils.core import setup
import py2exe

# Change the path in the following line for webdriver.xpi
data_files = [('selenium/webdriver/firefox', ['C:/Python27/Lib/site-packages/selenium/webdrive/firefox/webdriver.xpi'])]

setup(
    name='General name of app',
    version='1.0',
    description='General description of app',
    author='author name',
    author_email='author email',
    url='',
    windows=[{'script': 'setup_test.py'}],   # the main py file
    data_files=data_files,
    options={
        'py2exe':
            {
                'skip_archive': True,
                'optimize': 2,
            }
    }
)

Does anybody know what is causing this and/or how to fix it? Thanks

McFizz
  • 3,013
  • 3
  • 18
  • 26
  • This could be a silly question, but the file is definitely located at C:/Python27/Lib/site-packages/selenium/webdrive/firefox/webdriver.xpi right? – Deem Apr 30 '17 at 22:18
  • Yes, I copied the directory directly out of my file explorer. It can be easy to overlook that though! – McFizz Apr 30 '17 at 22:19
  • 1
    Hmm.. Perhaps something here could be useful http://stackoverflow.com/questions/25653870/missing-file-in-compiled-py2exe-app-selenium, or here https://mail.python.org/pipermail/python-win32/2012-July/012475.html – Deem Apr 30 '17 at 22:20
  • I looked over both of those posts and tried to replicate their solutions, but to no avail. I will continue to see if I can find a similar fix. Do you have any other suggestions? – McFizz Apr 30 '17 at 22:43
  • Ah that sucks.. Unfortunately I'm not running Windows, so I can't really replicate the issue myself. Seems like a lot of people have been asking that question though, so someone must have figured it out - good luck! – Deem Apr 30 '17 at 22:45

0 Answers0