Reputation: 1109
I have created an application in Python and have made it executable using cx_Freeze
.
When the script was not converted into an executable it used to take an input from the cmd
(in windows). However, when it is converted into exe it doesn't prompt me for an input.
I have used the following code as setup.py
for my script.
includefiles = ["checkPointValueSheets.py"] # include any files here that you wish
includes = []
excludes = []
packages = ["lxml"]
exe = Executable(
# what to build
script = "app.py", # the name of your main python script goes here
initScript = None,
base = None, # if creating a GUI instead of a console app, type "Win32GUI"
targetName = "aflPredictionAutomation.exe", # this is the name of the executable file
copyDependentFiles = True,
compress = True,
appendScriptToExe = True,
appendScriptToLibrary = True,
icon = None # if you want to use an icon file, specify the file name here
)
setup(
# the actual setup & the definition of other misc. info
name = "app", # program name
version = "0.1",
description = 'A general enhancement utility',
author = "K Perkins",
author_email = "",
options = {"build_exe": {"excludes":excludes,"packages":packages,
"include_files":includefiles}},
executables = [exe]
)
Please help me initiating the cmd console the moment I hit enter on my exe.
I am getting this error when executable is run..
Thanks
Upvotes: 0
Views: 4415
Reputation: 148870
It is allready in the comment in your code (and in cx_Freeze’s documentation, you should simply comment the 2 lines
if sys.platform == "win32":
base = "Win32GUI"
If you let base = None
your exe will be a console application (and not a GUI one) and Windows will automatically provide it with a new console if not allready started from one.
Upvotes: 2