Im trying to buld my app with selenium, i have this setup.py:
import sys
from cx_Freeze import setup, Executable
path_drivers = ( "C:\Python34\Lib\site-packages\PyQt5\plugins\sqldrivers\qsqlmysql.dll", "sqldrivers\qsqlmysql.dll" )
includes = ["atexit","PyQt5.QtCore","PyQt5.QtGui", "PyQt5.QtWidgets","PyQt5.QtSql", "selenium"]
includefiles = [path_drivers]
excludes = [
'_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
'Tkconstants', 'Tkinter'
]
packages = ["os"]
path = []
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {
"includes": includes,
"include_files": includefiles,
"excludes": excludes,
"packages": packages,
"path": path
}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
exe = None
if sys.platform == "win32":
exe = Executable(
script="main.py",
initScript = None,
base=None,
targetName="zeus.exe",
compress = True,
copyDependentFiles = True,
appendScriptToExe = False,
appendScriptToLibrary = False,
icon = None
)
setup(
name = "telll",
version = "0.1",
author = 'me',
description = "My GUI application!",
options = {"build_exe": build_exe_options},
executables = [exe]
)
The build finish with no problems, but when i run my application:
ImportError: No module named 'httplib'
My configuration:
Python 3.4.3 32bit.
PyQt5
Selenium 2.46.0
Thaks for the help
httplib either isn't in your directory path or hasn't been imported.
try adding either of these two scripts to your code:
import httplib
httplib = httplib(config_file="your directory path to httplib")
Related
I try to make an executable file of my python script by using CX_Freeze.
import sys
from cx_Freeze import setup, Executable
company_name = 'FF'
product_name = 'Kleurmeting aardappelvleeskleur'
bdist_msi_options ={"upgrade_code": '{48B079F4-B598-438D-A62A-8A233A3F8901}',
"add_to_path": False,
"initial_target_dir": r'[ProgramFilesFolder]\%s\%s' % (company_name, product_name),
}
build_exe_options = {"includes": ['cv2', 'glob', 'numpy', 'pathlib', 'skimage', 'pandas',
'colormath.color_objects', 'colormath.color_conversions', 'os',
'argparse', 'tkinter', 'PIL', 'tkinter', 'sys', 'datetime'],}
# base="Win32GUI" should be used only for Windows GUI app
base = None
if sys.platform == "win32":
base = "Win32GUI"
exe = Executable(script="Apptest.py",
base=base,
)
setup(
name = product_name,
version = "0.3",
description = "Kleurmeting aardappelrassen!",
executables=[exe],
options={
"bdist_msi" : bdist_msi_options,
"build_exe" : build_exe_options}
)
It works pretty fine, but the problem is in my script Apptest.py I make a reference to an other script named Innovatortest.py.
So, I want to make one .exe, with two scripts.
How can I add this script in the setup.py?
Thanks
I want to convert a application into an executable file and have use cx_freeze for that purpose.
But i got this Error-Message:
......executable.py, line 86, in base
raise ConfigError(f"no base named {name!r}")
cx_Freeze.exception.ConfigError: no base named 'Win32GUI'
Versions: Win 10 Home (x64); Python 3.9.6; Cx_Freeze 6.8; PyQt - 5.15.4;
It's strange because some time ago this code worked without problem?!
import sys
from cx_Freeze import setup, Executable
try:
from cx_Freeze.hooks import get_qt_plugins_paths
except ImportError:
include_files = []
else:
# Inclusion of extra plugins (new in cx_Freeze 6.8b2)
# cx_Freeze imports automatically the following plugins depending of the
# use of some modules:
# imageformats - QtGui
# platforms - QtGui
# mediaservice - QtMultimedia
# printsupport - QtPrintSupport
#
# So, "platforms" is used here for demonstration purposes.
include_files = get_qt_plugins_paths("PyQt5", "platforms")
# base="Win32GUI" should be used only for Windows GUI app
base = None
if sys.platform == "win32":
base = "Win32GUI"
build_exe_options = {
"excludes": [""],
"include_files": include_files,
}
bdist_mac_options = {
"bundle_name": "Test",
}
bdist_dmg_options = {
"volume_label": "TEST",
}
executables = [Executable("main.py", base=base, target_name="TESTS")]
setup(
name="simple_PyQt5",
version="0.3",
description="Sample cx_Freeze PyQt5 script",
options={
"build_exe": build_exe_options,
"bdist_mac": bdist_mac_options,
"bdist_dmg": bdist_dmg_options,
},
executables=executables,
)
found the solution.
Updated all requirements (pipĀ“s) and then it worked. Dont know why this happend but ok
I am not able to compile with Cx_freeze, When I put the item "icon" nothing happens.
import sys
from cx_Freeze import setup, Executable
base = None
if sys.platform == 'win32':
base = 'Win32GUI'
executables = [Executable(script ='RabbiGet.py',base=base, icon ='icone.ico')]
includefiles = ['icone.ico','Softplan.png','rabbit.png','saj.png','down.png']
setup(name='RabbiGet',
version='1.0',
description='RabbitMQ downs',
author = "Patric Guisolffi",
options = {'build_exe': {'include_files':includefiles,'packages': ["os","sys","ctypes","win32con"]}},
executables=executables
)'''
Try like this:
include_files = ['Softplan.png','rabbit.png','saj.png','down.png']
options = {
'build_exe': {
'include_msvcr': True,
'build_exe': 'name_exe',
'include_files': include_files,
}
}
setup(
name="RabbiGet",
version="1.0",
author = "Patric Guisolffi",
description='RabbitMQ downs',
executables=executables,
options=options,
)
I am converting a .py file to a .exe file using cx_freeze. Which is working but I can not seem to change it so that my .exe file has the custom icon I have. This is what I have tried so far:
'''
import sys
import os
from cx_Freeze import setup, Executable
sys.path.append(os.path.abspath("./src/"))
sys.path.append(os.path.abspath("./src/gui/rc/"))
**Dependencies are automatically detected, but it might need fine tuning.**
buildOptions = {
"packages": ["src.gui",
"src.qt_models",
"src.data",
"src.libs",
"src.tguiil",
"src.graphics"
],
"includes": ["scipy.sparse.csgraph._validation",
"scipy.ndimage._ni_support",
"scipy._distributor_init"
],
"include_files": ["database/"],
"excludes": []
}
installOptions = {}
bdistOptions = {}
base = None
** Uncomment for GUI applications to NOT show cmd window while running.**
if sys.platform =='win32':
base = 'Win32GUI'
executables = [
Executable(script = 'src/facile.py', base=base, targetName = 'facile.exe', icon = 'facade_logo.ico')
]
setup(name='Facile',
version = '1.0',
description = 'A platform for generating Python APIs used to control graphical user interfaces.',
options = {
"build_exe": buildOptions,
"install_exe": installOptions,
"bdist_msi": bdistOptions,
},
executables = executables)
'''
I have no idea what could be wrong.
Figured it out! Just needed to add relative path to file and add distutils as a package to handle external dependencies:
'''
buildOptions = {
"packages": [
# Facile sub-packages
"src.gui",
"src.qt_models",
"src.data",
"src.libs",
"src.tguiil",
"src.graphics",
# External dependencies
"distutils"
],
'''
Hey am relatively new to compiling python scripts to exe. Im using cx_freeze to compile my scripts and once its built i run the exe and it gives me this error. Have google around alot but not too sure. Error is:
Cannot import traceback module.
Exception: No module named re
Original Exception: No module named re
Not too sure how to go about fixing this. I read that possibly there is a clash between a module named re? in python? and a module named re in cx_freeze module?
My setup file looks like:
from cx_Freeze import setup, Executable
includes = []
includefiles = ['remindersText.pkl']
eggsacutibull = Executable(
script = "podlancer.py",
initScript = None,
base = 'Win32GUI',
targetName = "podlancer.exe",
compress = True,
copyDependentFiles = True,
appendScriptToExe = False,
appendScriptToLibrary = False,
icon = None
)
setup(
name = "Podlancer",
version = "0.1",
author = 'jono',
description = "Podlancer UI script",
options = {"build_exe": {"includes":includes, "include_files": includefiles}},
executables = [eggsacutibull]
)
Try to change
includes = []
to
includes = ["re"]
That worked for me
cx_freeze will barf if the runtime working directory is not the directory that the executable is in.
Is re the first import you do? What happens when you do them in a different order?
Meeting this same problem putting re in includes didn't work for me. It produced a cx_Freeze.freezer.ConfigError when rebuilding the .py file.
import sys
from cx_Freeze import setup, Executable
build_exe_options = {'include_files': ['re']}
setup( name = "Foreground Window Montior",
version = "0.1",
description = "Query the foreground window.",
options = {'build_exe': build_exe_options},
executables = [Executable("actWin_Query.py")])
If I put re in packages rather than in include_files it did not produce this compile error.
import sys
from cx_Freeze import setup, Executable
build_exe_options = {"packages": ["re"]}
setup( name = "Foreground Window Montior",
version = "0.1",
description = "Query the foreground window.",
options = {'build_exe': build_exe_options},
executables = [Executable("actWin_Query.py")])