[Tutor] GETTING AN _.EXE VERSION OF _.PY program to run on a machine that does not have Python installed on it. (fwd)

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Thu Sep 15 19:59:16 CEST 2005



---------- Forwarded message ----------
Date: Wed, 14 Sep 2005 21:33:08 -0500
From: JackA <jacka at mts.net>
To: Danny Yoo <dyoo at hkn.eecs.berkeley.edu>
Subject: Re: [Tutor] GETTING AN _.EXE VERSION OF _.PY program to run on a
    machine that does not have Python installed on it.

Sorry for the boo boo but am learning and will remember.  No .DOC's.

With change of "Windows"  to "Console"  It is working as required.  Now that
the need to get it working is out of the way, I will have to take a better
look at Python.  From what I have seen in the on line information in the
course of doing this, I conclude seems to be an efficient lauguage.  I'l
have to see if I can find a couple of good books on it.

Thanks again and Jason is also very appreciative of all the help recieved.
Jack

----- Original Message -----
From: "Danny Yoo" <dyoo at hkn.eecs.berkeley.edu>
To: "JackA" <jacka at mts.net>
Cc: <tutor at python.org>
Sent: Tuesday, September 13, 2005 12:47 PM
Subject: Re: [Tutor] GETTING AN _.EXE VERSION OF _.PY program to run on a
machine that does not have Python installed on it.


>
>
> 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.
>
> Hi Jack,
>
> 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:
>
>    http://expita.com/nomime.html
>
> gives some more reasons for staying with plain text, at least on technical
> mailing lists.
>
>
> 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
> 'setup.py' file.
>
>
>
>> 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
>>
>> setup(windows=['PROG.PY'])
>        ^^^^^^^
>
> 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
> import py2exe
>
> setup(console=['PROG.PY'])
> ######
>
>
> Best of wishes to you.



More information about the Tutor mailing list