[wingide-users] Problem with raw_input()

Wingware Support support at wingware.com
Mon Jul 18 12:53:02 MDT 2011


On 7/18/11 2:09 PM, Chiaki wrote:
> I try to load a script plugin for Wing IDE, but I have a problem with the
> input_raw()
> For example:
>
> def setPath():
>      path = raw_input("Add Path: ")
>      return path
>
> def main():
>      f = setPath()
>      print f
>
> The input_raw() works fine when I evaluate the code in Python Shell, but is
> not compatible when Wing IDE execute as script.
>
> /Script Input Error::Scripts cannot read from stdin
> Runtime failure details:
> Exception: "<type 'exceptions.EOFError'>"
> Value = ''/
>
> How can I input text into my variable when I load the code as Wing IDE
> script?

If you define the script as follows it will prompt for 'path' at the 
bottom of the IDE window when the script 'set-path' is invoked:

def set_path(path):
   print path

You can also control the prompt string and expected data type, among 
other things, with the 'arginfo' function attribute, which is documented 
here:

http://wingware.com/doc/scripting/syntax

There are some examples of this in scripts/editor_extensions.py in your 
Wing installation.

-- 

Stephan Deibel
Wingware | Python IDE
Advancing Software Development

www.wingware.com



More information about the wingide-users mailing list