> I want to make a binary file , which would execute on it's own.

First do
$ which python
to get the location of your python binary. The default, i think, is just
/usr/bin/python.

Then add this line to the top of your file:
#!/usr/bin/python          (or whatever the `which` command returned)

then finally do this command:
$ chmod +x <file>.py

This makes <file> executable ( that's what the x stands for ).

now run it with:
$ ./<file>.py

you can also trim the .py from the file and it will work just the same.

To have your script work like installed binaries, put it in a folder in your
PATH variable. For example, if you added the path /home/<you>/bin/ to your
path variable ( PATH=$PATH:/home/<you>/bin/ ) Bash would search that
directory when you typed in a command to execute. What this means is if you
rename your <file>.py to just <file> and stick it in /home/<you>/bin/ you
could just do

$ <file>

at any time to run your program.

hope my verbosity is helpful.

-- 
-Nate
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to