[Tutor] running as generic file type

Kent Johnson kent37 at tds.net
Thu Dec 22 12:05:59 CET 2005


Eli Zabielski wrote:
> Hi
> I'm very new to python, I created my first program, saved it as .py. I 
> wanted to show it to my friends and I tested running it on another 
> computer, one without python, and it didn't work, it gave me a list of 
> programs to try to run it on (ex. word, IE, Mozilla). Is there any way 
> to save it so anyone with windows can use it?

Eli,

The .py file is just a text file containing the program, it requires Python to run. Just 
like you would not give a friend a Word file and expect them to be able to open it without 
the Word program on their computer, to run a Python program you need the Python 
interpreter. You have a few options:

- Install Python on the other computer. If you have done this already on your computer you 
know it is not very hard.
- Create an executable program that includes your program and the Python interpreter in 
one bundle. The program to do this is called py2exe, you can find it here:
http://www.py2exe.org/

The disadvantage of this is that there is a bit to learn and the resulting executables are 
much larger than the original program (typically several megabytes) because they include 
the Python interpreter as well as your program.

- Movable Python is a way of building a Python environment on a memory stick. You can 
bring it to another computer just by plugging in the memory stick. This might be a good 
solution for you especially if you already have a memory stick.
http://www.voidspace.org.uk/python/movpy/

Kent



More information about the Tutor mailing list