[Tutor] Linux Programs

Rick Pasotto rick@niof.net
Thu, 3 May 2001 23:05:17 -0400


On Thu, May 03, 2001 at 09:45:34PM -0400, Timothy M. Brauch wrote:
> Okay, I'm slowly making a move from Windows to (Red Hat 7.0) Linux, but
> there are somethings in Linux that I just can't figure out how to do. 
> One of these things is using Python.
> 
> I can open the Python interpreter (by typing 'python' in the terminal
> window).  I can even open Idle when I am running xWindows (I just type
> 'idle' in the terminal).  And, I can write and run programs in Idle.
> 
> But, the problem comes after that.  I can't get my programs to run
> outside of Idle.  I know I have to add a line at the beginning of each
> python file, but I don't know what that line is.  When I wrote Python
> files for a class on the (Mandrake) Linux machines, the line was:
> 
> #!/usr/bin/python

I think the prefered way is:

#!/usr/bin/env python

This should find the appropriate python no matter where it's located.

> This line doesn't work on my computer.  All I get is the file openned in
> a text editor.

Huh? This doesn't make sense to me. In unix you don't get an editor
unless you *ask* for an editor.

How are you trying to run the file?  What is your command line? Or are
you in X and clicking on an icon?

Even without the '#!' line and regardless of the permissions (well, you
do need 'read' permission) you can run your program by entering:

python test.py

-- 
"The financial policy of the welfare state requires that there be no
way for the owners of wealth to protect themselves.  This is the
shabby secret of the welfare statists' tirades against gold.   Deficit
spending is simply a scheme for the 'hidden' confiscation of wealth.
Gold stands in the way of this insidious process.   It stands as a
protector of property rights."
		-- Alan Greenspan
		   Rick Pasotto email: rickp@telocity.com