Webdriverprefs.json not found - pyinstaller
I have a python program that uses the selenium package and when building an exe from that with pyinstaller
it, it creates the exe correctly. When trying to open firefox from this application, I got the following error:
IOError: [Errno 2] No such file or directory: 'C: \\ users \\ mohamed \\ Temp \\ _ MEI622 \\ selenium \\ webdriver \\ firefox \\ webdriver_prefs.json'
I found this solution, but it doesn't work for me:
Py2exe does not copy webdriver_prefs.json file into assemblies
Any ideas?
source to share
just include these (.json and .xpi) files as arbitrary files in your .spec file.
here is what worked for me (you may have to change the paths):
needed_selenium_files = [(r'selenium\webdriver\firefox\webdriver_prefs.json',
r'C:\Anaconda\Lib\site-packages\selenium\webdriver\firefox\webdriver_prefs.json',
'DATA'),
(r'selenium\webdriver\firefox\webdriver.xpi',
r'C:\Anaconda\Lib\site-packages\selenium\webdriver\firefox\webdriver.xpi',
'DATA')]
and then:
coll = COLLECT(exe, a.binaries, needed_selenium_files, ...)
more on the PyInstaller manual: http://pythonhosted.org/PyInstaller/#toc-class-table-of-contents and also http://pythonhosted.org/PyInstaller/#adding-files-to-the-bundle
source to share
In my experience pyinstaller always comes up with something when building executables. I suggest you py2exe instead .
source to share