learning to use terminal and gedit

Asked by Tom Johnston

How do I run a python program .py ? I tried from gedit and I tried using the terminal. I get a not defined error. Do I need a plugin? I'm new to all this and am trying to teach myself python programming.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu python-defaults Edit question
Assignee:
No assignee Edit question
Solved by:
Sam_
Solved:
Last query:
Last reply:
Revision history for this message
Best Sam_ (and-sam) said :
#1
Revision history for this message
El Pensador (el-pensador) said :
#2

Hi,
There are several ways to run a python program or script. Right click on program.py, select the "Permissions" tab and check "Allow executing file as program". Then, you can:

1) double-click on program.py and select either "run in a terminal" (useful for debugging a program) or "run"

2) In a terminal: go to the directory where the program.py is located and use the command : python program.py

Revision history for this message
Aruna Hewapathirane (aruna-hewapathirane) said :
#3

Hi Tom,

Please watch this: http://www.youtube.com/watch?v=tKTZoB2Vjuk and the other lessons. Step by step instrcutions.

And a warm welcome to you :-)

Revision history for this message
Tom Johnston (tomwjohnston176) said :
#4

Thanks Sam_, that solved my question.

Revision history for this message
Tom Johnston (tomwjohnston176) said :
#5

Thank you Aruna

Tom

2011/4/9 Aruna Hewapathirane-අරැණ හේවාපතිරණ <
<email address hidden>>

> Your question #152243 on python-defaults in Ubuntu changed:
>
> https://answers.launchpad.net/ubuntu/+source/python-defaults/+question/152243
>
> Aruna Hewapathirane-අරැණ හේවාපතිරණ proposed the following answer:
> Hi Tom,
>
> Please watch this: http://www.youtube.com/watch?v=tKTZoB2Vjuk and the
> other lessons. Step by step instrcutions.
>
> And a warm welcome to you :-)
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
>
> https://answers.launchpad.net/ubuntu/+source/python-defaults/+question/152243/+confirm?answer_id=2
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
>
> https://answers.launchpad.net/ubuntu/+source/python-defaults/+question/152243
>
> You received this question notification because you are a direct
> subscriber of the question.
>