473,320 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

A few q's on python files.

hiya,
i'm new to python (by a week) but am learning fast (that's what I like
about python--it's simplicity). I got disgusted with C and C++ (i was
learning) probably because of a bad copy of Visual C++ 6.0 that gave me errors.

I noticed that IDLE doesn't have an option to allow you to convert a .py or
pyc. file into an executable. Why? Am i wrong? Where can I find one (if I'm
right)?

Jul 18 '05 #1
3 1323
On windows there's py2exe which packs a python program
so that it can be distributed "like" and .exe, but Python
is a bytecode language (a la Java) so it is never actually
compiled into machine language. The .pyc files are the
bytecode that is actually executed. For C programmers
this takes some getting accustomed to.

Larry Bates

Joseph Quigley wrote:
hiya,
i'm new to python (by a week) but am learning fast (that's what I like
about python--it's simplicity). I got disgusted with C and C++ (i was
learning) probably because of a bad copy of Visual C++ 6.0 that gave me
errors.

I noticed that IDLE doesn't have an option to allow you to convert a .py
or pyc. file into an executable. Why? Am i wrong? Where can I find one
(if I'm right)?

Jul 18 '05 #2
Joseph Quigley <cp*******@gmail.com> wrote:

i'm new to python (by a week) but am learning fast (that's what I like
about python--it's simplicity). I got disgusted with C and C++ (i was
learning) probably because of a bad copy of Visual C++ 6.0 that gave me errors.
I find that very hard to believe.
I noticed that IDLE doesn't have an option to allow you to convert a .py or
pyc. file into an executable. Why? Am i wrong? Where can I find one (if I'm
right)?


Like VB6 and Perl, Python is interpreted, not compiled. You don't compile
it into an .exe. You pass the script to the python.exe interpreter, where
it is executed.

There are packages (like py2exe) that can convert your script into an
executable, but they are essentially installers. They package your script,
and all the scripts and libraries it needs, into a single file along with
the interpreter. When the .exe is executed, it extracts the interpreter
and the scripts into a temp directory, and fires up the interpreter.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 18 '05 #3
Tim Roberts wrote:
There are packages (like py2exe) that can convert your script into an
executable, but they are essentially installers. They package your script,
and all the scripts and libraries it needs, into a single file along with
the interpreter. When the .exe is executed, it extracts the interpreter
and the scripts into a temp directory, and fires up the interpreter.


Correction: py2exe doesn't really do that at all. At least,
not any of the "single file" or "extracting" stuff.

Py2exe packages all the Python bytecode into a single zip
file (library.zip) and also includes all .pyd and .dll
files required to run the program, along with a stub
..exe file which instantiates an interpreter (from pythonXX.dll)
and runs the main script.

Installers such as InnoSetup are what you use to do the
"single file" stuff, and when you run them they do the
usual Windows installer stuff like extracting files to the
installation directory, creating icons, etc.

Finally there are tools (names don't come to mind since I don't
use them, but they're easy to find) which *can* do that
"extract to temporary directory" thing rather than the InnoSetup
type of installer, but they're relatively rarely used I think.

-Peter
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
46
by: Jon Perez | last post by:
Can one run a 1.5 .pyc file with the 2.x version interpreters and vice versa? How about running a 2.x .pyc using a 2.y interpreter?
2
by: Roose | last post by:
With some googling I have found these resources: http://docs.python.org/ext/win-dlls.html http://www.python.org/doc/faq/windows.html I have a large Win32/MFC/C/C++ application that has an...
10
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. ...
5
by: Michael Sperlle | last post by:
Is it possible? Bestcrypt can supposedly be set up on linux, but it seems to need changes to the kernel before it can be installed, and I have no intention of going through whatever hell that would...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.