I tried to build a selenium application with py2exe (python 3.4).
However that doesn't work.
If I execute the resulting .exe I get
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\student
\Desktop\0.1\dist\automate.exe\selenium\webdriver\firefox
\webdriver_prefs.json'
I realized that webdriver_prefs.json is not bundled. As recommended in https://code.google.com/p/selenium/issues/detail?id=6808 I added ("selenium\\webdriver\\firefox", ["webdriver_prefs.json", "webdriver.xpi"])
to my data_files. The files are copied to my dist/
. However this does not help with the path, because Python looks for the files in the .exe/.zip.
Any hints to fix the issue? Can I bundle the json with the other files?
The relevant code in selenium is:
if not FirefoxProfile.DEFAULT_PREFERENCES: with open(os.path.join(os.path.dirname(__file__), WEBDRIVER_PREFERENCES)) as default_prefs: FirefoxProfile.DEFAULT_PREFERENCES = json.load(default_prefs)
I have the same problem with packaging splinter 0.7 apps, which of course use selenium-2.44, so hopefully this issue's resolution will help with the splinter issue, as well.