13

This is a problem that has been bothering me for a while. I have looked it up, but found no answer. I have also tried figuring it out myself, but have not succeeded. Whenever I create and try to freeze a program with the input() function in it I get the same error. enter image description here

I have tried running the .exe in command prompt but I get the same error. My setup.py script is below.

import cx_Freeze, sys
from cx_Freeze import setup, Executable

exe=Executable(
     script="input.py",
     base="Win32Gui",

     )
includefiles=[]
includes=["re"]
excludes=[]
packages=[]
setup(

     version = "0",
     description = "No Description",
     author = "Anthony",
     name = "0",
     options = {'build_exe': {'excludes':excludes,'packages':packages,'include_files':includefiles}},
     executables = [exe]
     )

And my short test script:

import sys,re
input('input')

Is this a problem I can fix, or do I just have to work without the input() function? I am using Python 3.2, on windows seven, with the corresponding cx_freeze version. Thanks in advance.

1 Answer 1

18

The Win32GUI base is designed for Windows GUI programs - i.e. they run in windows, not at a command prompt. So there's no stdin, and you can't use input().

If you want to create a console program, set base='Console' (or base=None, since Console is the default).

1
  • Where should I add the "base='console' " keyword, to make it run in the console? Commented Apr 16, 2017 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.