I am following this guide for python 2.7 :
http://docs.python.org/tutorial/interpreter.html
I do all it says: I have a python file:
#! /usr/bin/env python
print "hello world !\n"
And from terminal, in the directory where is the file I type:
chmod +x hello_world.py
The file is name hello_world.py; But nothing happens, it doesn’t print “hello world\n”.
To give a bit more description: the chmod command changes the permissions of a file on a Unix-style system. The +x in the command:
Sets the “Executable” bit for the hello_world.py file, thereby making it a script which can be executed. Thus to run the script:
The ./ in front indicates that the file is in the current directory. Alternatively, you can always run a script by invoking the python interpreter directly (regardless of permissions) like so: