Hello, I'm learning Python. It is my first interpreted language. I have some experience with C and C++. I must admit that it's very hard for me to accept a concept of interpreted language. For example I write code in C++, compile it, link it and I have .exe file which I can send to my friend who doesn't have any C++ compiler or anything and it works. So I can see with my own eyes (and others as well) product and that is .exe program that can be run on different machines. On the other hand, I wrote simple programs (or scripts!?! - don't know difference) in Python, but whenever I want to see result I need to open Python shell. I simply don't have a feeling that I amde something. How to send Python program to my friend who doesn't have Python installed? Is it possible at all?
I'm sorry if this question sounds stupid to you, but I'm really confused. I know that testing and debugging is easier with intepreted language, but how to make a real program in interpreted language?

If anyone can explaine me this issue, it would be greatly appreciated.

Thanks

Recommended Answers

All 11 Replies

The Python Shell is only used to test short Python statements. Any regular Python programs are written on the editor of one of the IDEs available.

If your friends have a Unix computer Python is most likely installed. With Windows computers you can encourage your friends to download and install Python or give them an install package on a CD, after all Python is open-source. There is also Py2Exe, a free program to that combines your file with the needed parts of the Python interpreter.

the very popular(notorious) program bittorrent is written in python. I wonder if the bittorrent windows executable used Py2Exe.

The telltale of the product of Py2Exe is that the exe file is accompanied by a runtime package consisting of at least two files one the Library.zip and the other the Python interpreter DLL like Python24.dll. A little similar to the Microsoft .NET languages that need a NET runtime package.

When Python is installed correctly, Python files should execute just like any other file -- it's just a matter of registering the file extension. It's the same situation as Java.

Yea but Micko has a point. it does suck when you want to take a simple short and sweet program you made with python to school or an internet cafe or any other place where you are not allowed to install stuff, i mean py2exe is good but whenever i use it i get a whole load of crap thrown in with the exe and a folder that has 5 or 6 .py files (i know they are needed but it's still anoying), ok it's good if you know where you are going but for quick and easy compilation and running python does lack...a lot

...and that is .exe program that can be run on different machines.

That's not necessarily true. Compiling a C/C++ program does not create a universal executable that can be installed on any machine. Whether the executable will work on your friend's machine depends on (a) what the program does, and (b) what the other machine's architecture is.

This is a larger issue in developing software for general use. If you're writing in a compiled language you're inevitably going to have to deal with a whole lot of architecture-specific compilation issues, which can be a huge pain in the rear, especially after you've just finished coding a large project. Nothing quite takes the wind out of your sails like getting a complex C program to work perfectly on an i386 and then having it consistently and mysteriously screw up on your boss's non-i386 machine.

If you're writing in an interpreted language, on the other hand, the code should, theoretically, be much more portable. Now all the user has to do is download the interpreter, which (again, in theory) ought to be as easy as pie.

Thats a very good point, i never looked at it that way, and i bet that if you use the py2exe to make a 'portable' program because it ships with the python24dll thingy then maybe thats actually a little more multi-system than a bog standard compiled exe. (then again maybe not hehe all speculation)

If you use Windows, you are in luck, you can download Movable Python also called "Python on a Stick" because it is meant to run Python from one of those USB Flash Drives.

Walmart around here sells a 128M USB Flash Drive for less than $20. It's the size of half a finger and is all you need. Install Movable Python on it and whatever program files you have and now you can carry Python with you to your friends Windows computer.

Movable Python is open-source and comes in two flavors, basic and standard. The latest standard version has Python 2.4.1, wxPython, SPE (an IDE), Tkinter, IDLE, Psyco and more. Download from:
http://sourceforge.net/projects/movpy

More info from:
http://www.voidspace.org.uk/python/movpy/index.html

Wehey very nice thats solved my issue

Now, if we could just sweet-talk the geniuses at Movable Python into making a version for Unix machines ...

well any language can be compiled or interpreted, there are c++ interpreters just as there are python compilers, so yea, just find a compiler.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.