[英]PY2EXE and SELENIUM ISSUE
After reading all posts about it, i still don't understand why my exe isn't working..... 阅读了有关它的所有文章后,我仍然不明白为什么我的exe无法正常工作.....
This is my "setup.py" : 这是我的“ 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:fgarbez-dev@netcourrier.com",
options = {
"py2exe":{
"bundle_files": 1,
"compressed":1,
}
}
)
This is the error.log : 这是error.log:
Traceback (most recent call last):
File "autovote.py", line 4, in <module>
File "zipextimporter.pyc", line 82, in load_module
File "selenium\webdriver\__init__.pyc", line 18, in <module>
File "zipextimporter.pyc", line 82, in load_module
File "selenium\webdriver\firefox\webdriver.pyc", line 34, in <module>
File "zipextimporter.pyc", line 82, in load_module
File "selenium\webdriver\remote\webdriver.pyc", line 25, in <module>
File "zipextimporter.pyc", line 82, in load_module
File "selenium\webdriver\remote\webelement.pyc", line 40, in <module>
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 work at all... I tried almost EVERYTHING i saw on the same topics...Nothing can solve it TT 但是我所有的文件都放在dist \\ selenium \\ webdriver中...编译时创建的...我也尝试了PYInstaller,那个根本没用...我尝试了所有在同一个目录下看到的所有内容话题...什么都解决不了TT
Thanks for helping :) 感谢您的帮助:)
I remade my setup.py : 我重新制作了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:fgarbez-dev@netcourrier.com",
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,
and 和
'bundle_files':1,
Now it's working....Well i still don't get it but at least it works :) 现在它正在工作....嗯,我仍然不明白,但至少它能工作:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.