Executable program is possible?

Thomas Heller thomas.heller at ion-tof.com
Mon Jan 21 11:13:46 EST 2002


"Paul Rubin" <phr-n2002a at nightsong.com> wrote
> J. Nielson <daculas at yahoo.com> writes:
> > you can download py2exe from the main site of Python,
> > http://www.python.org

which is false AFAIK.

> > or you can see this page:
> > http://starship.python.net/crew/theller/py2exe/

This is the canonical homepage.

> I'm wondering a couple things about this (I'm primarily a Linux user):
>
> 1) If I write a Python prog under Linux, can I cross-build it as a
> Windows executable running py2exe under Linux?

Interesting thought. In theory it should be doable, in practice
it will not work.

>   Does the exe have a
> reasonable chance of being useable on a Windows system immediately, if
> I don't have a Windows system to test on?

Again, in theory yes, in practice no.
py2exe does search for used modules by scanning for 'import' statements
in the python byte code, but it does not find __import__() calls.
A lot of modules/packages use the __import__ function to do some
import magic, and you have to include additional modules 'manually'.
PIL is such an example - it finds it's plugins with this mechanism.

>
> 2) How large is the .exe file typically, if the Python program isn't
> large and doesn't use a lot of modules?

A trivial "print 'Hello, World'" exe-file is 48 kBytes (plus the
pythonxx.dll, which it still needs).

>
> Thanks.

You're welcome,

Thomas





More information about the Python-list mailing list