I have a python (34) script which uses selenium package, and when creating an exe using py2exe I have the following error
webdriver_prefs.json not found
I found the following solution, but I dont get it :
when freezing scripts to exe don't use --onefile , use --onedir instead , it will generate one folder for all files and then copy selenium folder in path c:\python27\lib\site-packages\selenium to your app folder and it works correctly
Here's my setup.py
from distutils.core import setup
import py2exe
data_filesR = [('selenium/webdriver/firefox', ['C:/Python34/Lib/site-packages/selenium/webdriver/firefox/webdriver.xpi','C:/Python34/Lib/site-packages/selenium/webdriver/firefox/webdriver_prefs.json'])]
setup(
name='Test',
version='1.0',
description='General description of app',
author='author name',
author_email='author email',
url='',
console = ['firefox.py'],
data_files=data_filesR,
options={
'py2exe':
{
"skip_archive": True,
"unbuffered": True,
'optimize': 2,
}
},
requires=['selenium'],
)