[Pythonmac-SIG] Re: Getting stdin using TextWrangler or BBEdit, but not MacPython

Louis Pecora pecora at anvil.nrl.navy.mil
Thu Mar 3 23:34:54 CET 2005


Bob Ippolito wrote:

>
> I don't know a damn thing about TextWrangler, but this works with any 
> Python that has a working stdin:
>
> while True:
>     text = raw_input("Input 2 ints and a float: ")
>     try:
>         i1, i2, f1 = [t(v) for (t, v) in zip((int, int, float), 
> text.split())]
>     except ValueError, e:
>         print 'Invalid Entry: %s' % (e,)
>         continue
>     break
>
> -bob

I should add that calling raw_input() gives the following error:

File "Drive:Users:louispecora:Code:python:test_folder:junk.py"; Line 
12:  EOFError: EOF when reading a line

Not sure what that tells you, but it seems to be how TextWrangler is 
dealing with stdin.  Almost sounds like it is expecting input to be 
right there when called and seeing none, just sees an  EOF.  Oh, well.

-- 
Cheers,

Lou Pecora

Code 6362
Naval Research Lab
Washington, DC  20375
USA
Ph:  +202-767-6002
email:  pecora at anvil.nrl.navy.mil



More information about the Pythonmac-SIG mailing list