HELP How do I start Python?

GaryTaig taig at melbpc.org.au
Sun Aug 31 06:03:08 UTC 2014


On 31/08/14 02:51, Robert Heller wrote:

> At Sun, 31 Aug 2014 01:37:39 +1000 taig at melbpc.org.au,  wrote:
>> What happens in Linux?


> Linux also has a PATH environment variable. This is a standard POSIX shell
> feature (which MS-DOS borrowed from), in a sense it is just like MS-DOS.
> (/usr/bin, as well as /bin should be in your PATH environment variable).
>
> Python is a scripting language.  Generally one does not run Python by itself,
> instead one creates Python scripts.  A Python script (like any other script)
> is just a text file that has execute permissions (chmod +x foo.py).  The first
> line of a Python script would contain a line like:
>
> #!/usr/bin/python -tt
>
> that tells the command shell (eg bash) that the stript needs to be passed to
> /usr/bin/python (the usually place where Python would be installed).  The rest
> of the file would be the Python program -- the script.
>
> Usually one creates these scripts with a plain text editor (emacs, vim, gedit,
> etc.).  And then makes them executable with the chmod command (eg chmod +x
> foo.py).  Python scripts *generally* end in .py, but they don't have to.  For
> security reasons, the current directory (.) is NOT included in the PATH
> environment variable, so to run a program in the current directory, one needs
> to specific the path explicity, generally with './' in front.
>
> So what ones does is something like:
>
> % vi helloworld.py
> (vi commands to write the hello world in Python)
> % chmod +x helloworld.py
> % ./helloworld.py
> Hello World

Huge thanks Robert.

By the time I've digested all that the brain will be much better 
equipped. Just now I Googled 'Path Environment Variable Linux' and found 
the 'set' command. This opened the floodgates and a wonderful stream of 
stuff to learn about flowed up the terminal window.

Thanks to your leads I've also found a fabulous web site, "Bash Guide 
for Beginners" by Machtelt Garrels. That will keep me going for many 
hours and is precisely where I needed to go.

First steps are now taken. Exploring the rest will be fun, like 
computers used to be.

Greatly appreciated, Robert.
GaryT






More information about the ubuntu-users mailing list