- #1
Saladsamurai
- 3,020
- 7
Hello
As strange thing is happening. I have created a simple file using emacs (on a Mac) that contains the following:
And I have saved it in the working directory as hello.py
In a terminal window, if I type
it works great. Now I set the execute bit using
and when I try to run it using ./hello.py I get syntax errors?!
Any ideas on this? Thanks!
As strange thing is happening. I have created a simple file using emacs (on a Mac) that contains the following:
Code:
def main():
print "hello!"
if __name__ == "__main__":
main()
And I have saved it in the working directory as hello.py
In a terminal window, if I type
Code:
python hello.py
it works great. Now I set the execute bit using
Code:
chmod +x hello.py
and when I try to run it using ./hello.py I get syntax errors?!
Code:
Python_Projects saladsamurai$ ./hello.py
./hello.py: line 1: syntax error near unexpected token `('
./hello.py: line 1: `def main():'
Any ideas on this? Thanks!