[python-win32] The input command

Blair Hall b.hall at irl.cri.nz
Mon Jun 23 19:10:39 EDT 2003


Does the 'input' command work as it should inside Pythonwin?

For example:

 >>> x = 3
 >>> y = 5
 >>> input("Please type in 'x+y': ") # type in the sum to the dialog

gives me the error:

Traceback (most recent call last):
   File "<interactive input>", line 1, in ?
   File "C:\Python22\lib\site-packages\Pythonwin\pywin\framework\app.py", 
line 368, in Win32Input
     return eval(raw_input(prompt))
   File "<string>", line 0, in ?
NameError: name 'x' is not defined

However, what I expected to happen was

 >>> eval( raw_input("Please type in 'x+y': ") ) # type in the sum to the 
dialog
8
 >>>

I there a way to fix this?




More information about the Python-win32 mailing list