Python code:
"<stdin>"
#!/usr/bin/env
print "Hello world!"
print "How are you?"
The above is some code that I applied onto a script and it works when run in TextWrangler, but when I put it in Terminal, it fails.
Why is this happening? Does it have to do with the way I open the file?
/usr/bin/envis not the correct path to Python. Most likely the shebang line should read:I am pretty sure it needs to be the first line, so delete the
"<stdin>"line as well (that’s ignored by Python anyway).Also make sure you have set the execute permission on the script:
chmod +x /path/to/script.py