Title: PY2EXE and SELENIUM ISSUE
Tags: python;selenium;webdriver;py2exe
Question: After reading all posts about it, i still don't understand why my exe isn't working.....
This is my "setup.py" :
# -*- coding: cp1252 -*-
from distutils.core import setup
import py2exe, sys, os
sys.argv.append('py2exe')
wd_path = 'C:\\Python27\\Lib\\site-packages\\selenium\\webdriver'
required_data_files = [('selenium/webdriver/firefox',
['{}\\firefox\\x86\\x_ignore_nofocus.so'.format(wd_path), '{}\\firefox\\amd64\\x_ignore_nofocus.so'.format(wd_path)]),('selenium/webdriver/remote',['{}\\remote\\getAttribute.js'.format(wd_path),'{}\\remote\\isDisplayed.js'.format(wd_path)])]
setup(
windows = [{'script': "autovote.py"}],
dll_excludes=['msvcr71.dll', "IPHLPAPI.DLL", "NSI.dll",  "WINNSI.DLL",  "WTSAPI32.dll"],
data_files = required_data_files,
name = "AutoVote 100% Naruto",
version="1.0",
description = "AutoVote 100% Naruto V1.0 réalisé par GARBEZ François contact:brenda58@example.org",
options = {
"py2exe":{
"bundle_files": 1,
"compressed":1,
}
}
This is the error.log :
Traceback (most recent call last):
File "autovote.py", line 4, in <module&gt;
File "zipextimporter.pyc", line 82, in load_module
File "selenium\webdriver\__init__.pyc", line 18, in <module&gt;
File "zipextimporter.pyc", line 82, in load_module
File "selenium\webdriver\firefox\webdriver.pyc", line 34, in <module&gt;
File "zipextimporter.pyc", line 82, in load_module
File "selenium\webdriver\remote\webdriver.pyc", line 25, in <module&gt;
File "zipextimporter.pyc", line 82, in load_module
File "selenium\webdriver\remote\webelement.pyc", line 40, in <module&gt;
File "pkgutil.pyc", line 591, in get_data
IOError: [Errno 2] No such file or directory: 'selenium\\webdriver\\remote\\getAttribute.js'
But i have all my files in my dist\selenium\webdriver... As it is created when compiling... I tried PYInstaller too, that one didn't brenda58@example.org... I tried almost EVERYTHING i saw on the same topics...Nothing can solve it T.T
Thanks for helping :)


Here is another answer: I remade my setup.py :
# -*- coding: cp1252 -*-
from distutils.core import setup
import py2exe, sys, os
sys.argv.append('py2exe')
wd_path = 'C:\\Python27\\Lib\\site-packages\\selenium\\webdriver'
required_data_files = [('selenium/webdriver/firefox',
['{}\\firefox\\x86\\x_ignore_nofocus.so'.format(wd_path), '{}\\firefox\\amd64\\x_ignore_nofocus.so'.format(wd_path)]),('selenium/webdriver/remote',['{}\\remote\\getAttribute.js'.format(wd_path),'{}\\remote\\isDisplayed.js'.format(wd_path)])]
setup(
windows = [{'script': "autovote.py"}],
name = "AutoVote 100% Naruto",
version="1.0",
description = "AutoVote 100% Naruto V1.0 réalisé par GARBEZ François contact:brenda58@example.org",
dll_excludes=['msvcr71.dll', "IPHLPAPI.DLL", "NSI.dll",  "WINNSI.DLL",  "WTSAPI32.dll"],
data_files = required_data_files,
options = {
"py2exe":{
"skip_archive": True,
}
}
The only difference is that i took off :
'zipfile':None,
'bundle_files':1,
Now it's working....Well i still don't get it but at least it works :)
Comment for this answer: Could someone explain to me, please ?

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2017:00:08/07/17', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<python><selenium><webdriver><py2exe>', 'Title': 'PY2EXE and SELENIUM ISSUE', 'ViewCount': 512, 'id': 45537891, 'user_AboutMe': '', 'user_AccountId': 10148259.0, 'user_DisplayName': 'Garbez François', 'user_Reputation': 321.0, 'user_Views': 219.0, 'user_id': 7495742.0}}