| | |
Compiling .py files...
![]() |
•
•
Join Date: Jun 2005
Posts: 4
Reputation:
Solved Threads: 0
Hi..
Ive been doing python for about 2 days now (my 1st programming language) and im wondering, after ive made the .py file, and all the codes in it, how do i run it?
To be honest im not even sure if the term compiling is right...
I am doing all of the work on Fedora Core 3 (im also new to linux. lol, though im not a computer noob, i do know my way around one
)
anyways, can anyone give me a link to a website, another post explaining this, or even explain it?
Ty in advance
Ive been doing python for about 2 days now (my 1st programming language) and im wondering, after ive made the .py file, and all the codes in it, how do i run it?
To be honest im not even sure if the term compiling is right...
I am doing all of the work on Fedora Core 3 (im also new to linux. lol, though im not a computer noob, i do know my way around one
)anyways, can anyone give me a link to a website, another post explaining this, or even explain it?
Ty in advance
AFAIK, python just works, something like Perl just works, no need to compile 
You do need a way to run python however

You do need a way to run python however
Firefox: no, its not the end all solution, it has its own issues and in time it will be just as insecure as IE, when its hit Firefox 6, if it makes it that far. Oh, and AOL pays for it, incase you didn't know.
Microsoft & Windows: If you hate it so much, move to linux, or bsd, or anything else, stop complaning and move on.
Good starting places: Gentoo Novell SUSE Fedora Core Apple
Microsoft & Windows: If you hate it so much, move to linux, or bsd, or anything else, stop complaning and move on.
Good starting places: Gentoo Novell SUSE Fedora Core Apple
•
•
Join Date: Jun 2005
Posts: 4
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by Zachery
AFAIK, python just works, something like Perl just works, no need to compile
You do need a way to run python however
and as for "python just works" how do i run .py files as a program? o.O
Eg. i have helloworld.py saved in /usr/bin/
what command do i run to run it as a program, and i also want to have it run as an executable...
A command like Python.exe Filename.py will do. It is simpler to run it from an editor/IDE like IDLE, see the "Starting Python" sticky right here.
On Windows, once you have installed Python, any .py file is associated with Python.exe, so you just double click on the .py file. I don't work with Linux, there should be a command of some kind.
On Windows, once you have installed Python, any .py file is associated with Python.exe, so you just double click on the .py file. I don't work with Linux, there should be a command of some kind.
May 'the Google' be with you!
C isn't hard to learn! It works well in the trenches. It only gets hard, if you want to program something fancy.
Python works at a much higher level, this simply means that a lot of things you will be coding in C many pages long is ready to go in a Python module (some of it written in C). Walking on foot, flying in a jetplane, each has its purpose.
Python works at a much higher level, this simply means that a lot of things you will be coding in C many pages long is ready to go in a Python module (some of it written in C). Walking on foot, flying in a jetplane, each has its purpose.
May 'the Google' be with you!
•
•
Join Date: Jun 2005
Posts: 4
Reputation:
Solved Threads: 0
hmm........
lol, though switching to a different language is gona give me all the same problems again *-* lol, ill have to find out how to compile .c files, and all that poo -.-
lol, though i supposes its the most worth while learning, so, know any good tuts? (That includes compiling the files.. through unix/linux terminal)
lol, though switching to a different language is gona give me all the same problems again *-* lol, ill have to find out how to compile .c files, and all that poo -.-
lol, though i supposes its the most worth while learning, so, know any good tuts? (That includes compiling the files.. through unix/linux terminal)
There is a Python online book/tutorial at:
http://www.byteofpython.info/
that is for the very beginner and addresses Python programming in the linux environment too.
The first step, be it Python or C, is a little steep. It's like learning to ride a bike. Try the tutorial or find someone in school that has done programming. Who knows, even a teacher or two may know.
http://www.byteofpython.info/
that is for the very beginner and addresses Python programming in the linux environment too.
The first step, be it Python or C, is a little steep. It's like learning to ride a bike. Try the tutorial or find someone in school that has done programming. Who knows, even a teacher or two may know.
May 'the Google' be with you!
•
•
Join Date: May 2005
Posts: 215
Reputation:
Solved Threads: 16
if your file is in /usr/bin and the file starts with
#!/usr/bin/python
the above method assumes you have python install in /usr/bin or better yet
#!/usr/bin/env python
this method will run it no matter where you installed python
you just need to make the file executable with the command
now you can just run it by entering its command hello.py. This will work because /usr/bin is in your normal path. If you had the program somewhere else like your home directory. you would need to type the whole path, /home/fallen/hello.py
It is not probably a good habit to be putting test programs in /usr/bin. It should not cause problems, but will make a mess of that directory. I myself have a python directory in my home directory
you also could ignore everything I said above and do it this way. type the command python then the location of the file
the above method will work if you are in the same directory as the program. else do it like this
#!/usr/bin/python
the above method assumes you have python install in /usr/bin or better yet
#!/usr/bin/env python
this method will run it no matter where you installed python
you just need to make the file executable with the command
Python Syntax (Toggle Plain Text)
chmod +x /usr/bin/hello.py
It is not probably a good habit to be putting test programs in /usr/bin. It should not cause problems, but will make a mess of that directory. I myself have a python directory in my home directory
you also could ignore everything I said above and do it this way. type the command python then the location of the file
Python Syntax (Toggle Plain Text)
python hello.py
Python Syntax (Toggle Plain Text)
python /full/path/to/hello.py
•
•
Join Date: Nov 2005
Posts: 1
Reputation:
Solved Threads: 0
Hi Friends,
I am new to Python programming. I had been given a simple project using c & python.The Project goes like this "To give .c and .py file's outputs as input to another .c file which should give single output". so please post ur valuable Solutions. My mail-id is krishnamohan516@yahoo.com.
I am new to Python programming. I had been given a simple project using c & python.The Project goes like this "To give .c and .py file's outputs as input to another .c file which should give single output". so please post ur valuable Solutions. My mail-id is krishnamohan516@yahoo.com.
![]() |
Similar Threads
Other Threads in the Python Forum
- Previous Thread: ssh changes the way python script behaves
- Next Thread: Running a 3rd party program from Python
| Thread Tools | Search this Thread |
address aliased anydbm app bash beginner bits calling casino changecolor cipher clear conversion coordinates corners count cturtle curves definedlines development dictionary digital dynamic events examples excel external feet file float format function gui handling hints homework iframe images import input java keycontrol line linux list lists loan loop matching mouse multiple number numbers output parsing path port prime programming projects py py2exe pygame pymailer python random rational raw_input recursion recursive scrolledtext searchingfile shebang signal singleton split string strings tails terminal text threading time tlapse tooltip tuple tutorial type ubuntu unicode url urllib urllib2 valueerror variable web-scrape whileloop word wxpython xlwt






