[Tutor] Invoking Python
bhaaluu at gmail.com
Thu Jun 26 15:57:41 CEST 2008
You can create a Python script on a *nix system and run it with:
$ python threeplusfour.py
You can place a shebang line as the first line of the script, which points
to the python interpreter:
Save the file, then make it an executable with:
$ chmod u+x threeplusfour.py
Then execute it with:
Why the dot-slash? Here is a good explanation:
You can also create a Python script and place it in a directory that is
included in your PATH (echo $PATH). Once the executable script is in
a directory in your PATH, you can execute it with:
b h a a l u u at g m a i l dot c o m
Kid on Bus: What are you gonna do today, Napoleon?
Napoleon Dynamite: Whatever I feel like I wanna do. Gosh!
On Thu, Jun 26, 2008 at 9:37 AM, kinuthiA muchanE <muchanek at gmail.com> wrote:
> On Thu, 2008-06-26 at 12:00 +0200, tutor-request at python.org wrote:
>> Or more commonly add a first line like:
>> #! /path/to/python/executable
>> Then you can simply make the file executable and run it by typing its
>> $ threeplusfour.py
> On my computer, running Linux Ubuntu, I always have to type
> ./threePlusFour.py to get it to run. Otherwise I get a not found
>> or double clicking it in your favourite file manager GUI tool.
>> See the topic "Add a Little style" in my tutorial, in the box
>> Note for Unix users
>> for more details.
> Tutor maillist - Tutor at python.org
More information about the Tutor