Now what!?
Diez B. Roggisch
deets at nospam.web.de
Sat May 10 12:24:24 EDT 2008
notbob schrieb:
> Grrr....
>
> I'm following A Byte of Python and into the while loops chap. I cp/paste
> while.py to a file and give 777 perms. I mv while.py to while and run it (./while)
> as a standalone script. I get errors.
>
> Here is the script:
>
> while.py
>
> http://www.ibiblio.org/swaroopch/byteofpython/read/while-statement.html
>
>
> When I run it as.....
>
> $ python while
>
> .....it works perfect. But, if I run it simply as.....
>
> $ ./while
>
> .....I get this:
>
> $ ./while
> number: illegal number: =
> ./while: line 6: running: command not found
> ./while: line 9: syntax error near unexpected token ('
> ./while: line 9: guess = int(raw_input('Enter an integer : '))'
>
> Why does it work one way and not the other. If I run the simple hello world
> script the same way ($ ./helloworld) and it works fine. Same shebang, same
> dir, same permission, etc. I even meticulously indented everything
> perfectly by hand. What am I missing?
I'm pretty sure you misse the correct shebang - the shell tries to
execute your script as shell-script, instead of invoking the interpreter.
Diez
More information about the Python-list
mailing list