exe error with cx_freeze
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 = ['reminder开发者_如何学JAVAsText.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")])
精彩评论