[Tutor] GETTING AN _.EXE VERSION OF _.PY program to run on a machine that does not have Python installed on it.
dyoo at hkn.eecs.berkeley.edu
Tue Sep 13 19:47:53 CEST 2005
On Mon, 12 Sep 2005, JackA wrote:
> I am attaching a word document copy of this EMail which might be easier
> to read and follow if your EMail window rearanges things to much.
Actually, please don't do that. *grin*
Word documents are actually not really usable in a programming language
forum. You're assuming that the recipients are using systems that are
capable of running Microsoft Word. You might be surprised, but this is
not necessarily true. For maximum utility, please stick to plain text
formats on Python-Tutor. The page:
gives some more reasons for staying with plain text, at least on technical
Anyway, to your question:
> I have created PROG.EXE from PROG.PY , but it appears NOT to be portable
> in that when I try to run PROG.EXE on my wife's machine which does not
> have Python installed on it I get a " See the logfile PROG.EXE log for
> details". The logfile has the following ;
> Traceback (most recent call last):
> File "PROG.PY", line 364, in ?
> File "PROG.PY", line 320, in Main
> EOFError: EOF when reading a line
Ok, I have an idea of what's going on here. Let's take a look at your
> The 6 lines of PyToExe.PY used to make PROG.EXE , is shown below
> starting with ### in line #1.
> ### PyToExe.PY = file name. _.PY > _.EXE
> from distutils.core import setup
> import py2exe
Ah. Change the line in your setup from using 'windows' to 'console'.
You're not making a graphical "Windows" program, but one that depends on
the console. Technially, a Microsoft Windows GUI program has no console,
and no access to standard input or output. That's why your program
breaks: it's unable to use raw_input(), since that's explicitely meant to
talk to standard input.
So, instead, your setup.py should look like:
from distutils.core import setup
Best of wishes to you.
More information about the Tutor