[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

The Disappearing Program?

W. eWatson

2/19/2010 11:20:00 AM

I've successfully compiled several small python programs on Win XP into
executables using py2exe. A program goes from a name like snowball.py to
snowball. A dir in the command prompt window finds snowball.py but not
snowball. If I type in snowball, it executes. What's up with that?
13 Answers

Andre Engels

2/19/2010 1:04:00 PM

0

On Fri, Feb 19, 2010 at 12:20 PM, W. eWatson <wolftracks@invalid.com> wrote:
> I've successfully compiled several small python programs on Win XP into
> executables using py2exe. A program goes from a name like snowball.py to
> snowball. A dir in the command prompt window finds snowball.py but not
> snowball. If I type in snowball, it executes. What's up with that?

No idea whether it has to do with your problem, but if it's executable
in Windows, its name is snowball.exe, not snowball.

--
André Engels, andreengels@gmail.com

Mark Lawrence

2/19/2010 2:19:00 PM

0

Andre Engels wrote:
> On Fri, Feb 19, 2010 at 12:20 PM, W. eWatson <wolftracks@invalid.com> wrote:
>> I've successfully compiled several small python programs on Win XP into
>> executables using py2exe. A program goes from a name like snowball.py to
>> snowball. A dir in the command prompt window finds snowball.py but not
>> snowball. If I type in snowball, it executes. What's up with that?
>
> No idea whether it has to do with your problem, but if it's executable
> in Windows, its name is snowball.exe, not snowball.
>

Not necessarily, it's perfectly possible to setup a Python script to run
on Windows using file associations in the same way that you can run a
command (.bat) file. If the OP types the command "ASSOC .py" without
the quotes at the command prompt, the response .py=Python.File tells you
that this association has been setup.

HTH.

Mark Lawrence.

Andre Engels

2/19/2010 2:34:00 PM

0

On Fri, Feb 19, 2010 at 3:19 PM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
> Andre Engels wrote:
>>
>> On Fri, Feb 19, 2010 at 12:20 PM, W. eWatson <wolftracks@invalid.com>
>> wrote:
>>>
>>> I've successfully compiled several small python programs on Win XP into
>>> executables using py2exe. A program goes from a name like snowball.py to
>>> snowball. A dir in the command prompt window finds snowball.py but not
>>> snowball. If I type in snowball, it executes. What's up with that?
>>
>> No idea whether it has to do with your problem, but if it's executable
>> in Windows, its name is snowball.exe, not snowball.
>>
>
> Not necessarily, it's perfectly possible to setup a Python script to run on
> Windows using file associations in the same way that you can run a command
> (.bat) file.  If the OP types the command "ASSOC .py" without the quotes at
> the command prompt, the response .py=Python.File tells you
> that this association has been setup.

And how does that invalidate what I wrote? One cannot associate the
empty extension, so if "snowball" runs a program, that's the program
in the file "snowball.exe" not the program in the file "snowball" that
has its extension associated to something - it has no extension, so
its extension cannot be associated.

--
André Engels, andreengels@gmail.com

Mark Lawrence

2/19/2010 3:16:00 PM

0

Andre Engels wrote:
> On Fri, Feb 19, 2010 at 3:19 PM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
>> Andre Engels wrote:
>>> On Fri, Feb 19, 2010 at 12:20 PM, W. eWatson <wolftracks@invalid.com>
>>> wrote:
>>>> I've successfully compiled several small python programs on Win XP into
>>>> executables using py2exe. A program goes from a name like snowball.py to
>>>> snowball. A dir in the command prompt window finds snowball.py but not
>>>> snowball. If I type in snowball, it executes. What's up with that?
>>> No idea whether it has to do with your problem, but if it's executable
>>> in Windows, its name is snowball.exe, not snowball.
>>>
>> Not necessarily, it's perfectly possible to setup a Python script to run on
>> Windows using file associations in the same way that you can run a command
>> (.bat) file. If the OP types the command "ASSOC .py" without the quotes at
>> the command prompt, the response .py=Python.File tells you
>> that this association has been setup.
>
> And how does that invalidate what I wrote? One cannot associate the
> empty extension, so if "snowball" runs a program, that's the program
> in the file "snowball.exe" not the program in the file "snowball" that
> has its extension associated to something - it has no extension, so
> its extension cannot be associated.
>

Darn, only half the story, sorry. When the OP types snowball something
executes. The command SET PATHEXT will show what file extensions are
set to run files. On my system the response is :-

c:\Users\Mark\Java2Python>set pathext
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY

So snowball with any one of the 12 extensions listed above would run on
my system without actually typing the extension. I'm just guessing but
has an executable been created but in another directory, so snowball.py
is running? Perhaps the best bet is simply to search appropriate
directories, or even the whole hard drive, for snowball.*. Then the OP
would know exactly what he has or hasn't got.

HTH.

Mark Lawrence

W. eWatson

2/19/2010 5:21:00 PM

0

On 2/19/2010 7:16 AM, Mark Lawrence wrote:
> Andre Engels wrote:
>> On Fri, Feb 19, 2010 at 3:19 PM, Mark Lawrence
>> <breamoreboy@yahoo.co.uk> wrote:
>>> Andre Engels wrote:
>>>> On Fri, Feb 19, 2010 at 12:20 PM, W. eWatson <wolftracks@invalid.com>
....
tories, or even the whole hard drive, for snowball.*. Then the OP
> would know exactly what he has or hasn't got.
>
> HTH.
>
> Mark Lawrence
>
Here's the answer. Consider this folder.

Afolder
abc.py
hello.py

I now apply py2exe steps to produce an "executable" for abc. The folder
now changes to

Afolder
build
dist
abc.py
hello.py

build are two new folders. dist contains abc.exe.

Somehow when I type abc at the command prompt, this follows a path to
dist, and finds abc.exe, where it executes properly.
Cute, eh? I have no explanation for it.

I have no idea what build is for, but dist contains a bunch of other
files that possible apply to doing this with other files in the Afolder.
hello.py maybe. The details seem to be shrouded. Possible a Google might
provide a full explanation.

CM

2/19/2010 6:57:00 PM

0

On Feb 19, 12:21 pm, "W. eWatson" <wolftra...@invalid.com> wrote:
> On 2/19/2010 7:16 AM, Mark Lawrence wrote:> Andre Engels wrote:
> >> On Fri, Feb 19, 2010 at 3:19 PM, Mark Lawrence
> >> <breamore...@yahoo.co.uk> wrote:
> >>> Andre Engels wrote:
> >>>> On Fri, Feb 19, 2010 at 12:20 PM, W. eWatson <wolftra...@invalid.com>
>
> ...
> tories, or even the whole hard drive, for snowball.*. Then the OP> would know exactly what he has or hasn't got.
>
> > HTH.
>
> > Mark Lawrence
>
> Here's the answer. Consider this folder.
>
> Afolder
>    abc.py
>    hello.py
>
> I now apply py2exe steps to produce an  "executable" for abc. The folder
> now changes to
>
> Afolder
>    build
>    dist
>    abc.py
>    hello.py
>
> build are two new folders. dist contains abc.exe.
>
> Somehow when I type abc at the command prompt, this follows a path to
> dist, and finds abc.exe, where it executes properly.
> Cute, eh? I have no explanation for it.

Are you sure it's executing abc.exe? If you are at a Python command
prompt within the "DOS shell" and you just type just abc, I think what
is happening is you are running abc.py, NOT abc.exe.

py2exe creates a dist folder (short for "distributables") by default
and puts your .exe into it along with whatever other files are needed
to run your application. Depending on how you set the bundling
options, this may be a lot of things or just 1-2 other things.

Che

W. eWatson

2/19/2010 9:43:00 PM

0

On 2/19/2010 10:56 AM, CM wrote:
> On Feb 19, 12:21 pm, "W. eWatson"<wolftra...@invalid.com> wrote:
>> On 2/19/2010 7:16 AM, Mark Lawrence wrote:> Andre Engels wrote:
>>>> On Fri, Feb 19, 2010 at 3:19 PM, Mark Lawrence
>>>> <breamore...@yahoo.co.uk> wrote:
>>>>> Andre Engels wrote:
>>>>>> On Fri, Feb 19, 2010 at 12:20 PM, W. eWatson<wolftra...@invalid.com>
>>
>> ...
>> tories, or even the whole hard drive, for snowball.*. Then the OP> would know exactly what he has or hasn't got.
>>
>>> HTH.
>>
>>> Mark Lawrence
>>
>> Here's the answer. Consider this folder.
>>
>> Afolder
>> abc.py
>> hello.py
>>
>> I now apply py2exe steps to produce an "executable" for abc. The folder
>> now changes to
>>
>> Afolder
>> build
>> dist
>> abc.py
>> hello.py
>>
>> build are two new folders. dist contains abc.exe.
>>
>> Somehow when I type abc at the command prompt, this follows a path to
>> dist, and finds abc.exe, where it executes properly.
>> Cute, eh? I have no explanation for it.
>
> Are you sure it's executing abc.exe? If you are at a Python command
> prompt within the "DOS shell" and you just type just abc, I think what
> is happening is you are running abc.py, NOT abc.exe.
>
> py2exe creates a dist folder (short for "distributables") by default
> and puts your .exe into it along with whatever other files are needed
> to run your application. Depending on how you set the bundling
> options, this may be a lot of things or just 1-2 other things.
>
> Che
Well, you are right. What proof do I have? In fact, I just tried to run
a program that was not converted, and left off py. It worked.

So maybe the only way to execute the compiled code is to to to dist?

CM

2/20/2010 5:00:00 AM

0

On Feb 19, 4:42 pm, "W. eWatson" <wolftra...@invalid.com> wrote:
> On 2/19/2010 10:56 AM, CM wrote:
>
> > On Feb 19, 12:21 pm, "W. eWatson"<wolftra...@invalid.com>  wrote:
> >> On 2/19/2010 7:16 AM, Mark Lawrence wrote:>  Andre Engels wrote:
> >>>> On Fri, Feb 19, 2010 at 3:19 PM, Mark Lawrence
> >>>> <breamore...@yahoo.co.uk>  wrote:
> >>>>> Andre Engels wrote:
> >>>>>> On Fri, Feb 19, 2010 at 12:20 PM, W. eWatson<wolftra...@invalid.com>
>
> >> ...
> >> tories, or even the whole hard drive, for snowball.*. Then the OP>  would know exactly what he has or hasn't got.
>
> >>> HTH.
>
> >>> Mark Lawrence
>
> >> Here's the answer. Consider this folder.
>
> >> Afolder
> >>     abc.py
> >>     hello.py
>
> >> I now apply py2exe steps to produce an  "executable" for abc. The folder
> >> now changes to
>
> >> Afolder
> >>     build
> >>     dist
> >>     abc.py
> >>     hello.py
>
> >> build are two new folders. dist contains abc.exe.
>
> >> Somehow when I type abc at the command prompt, this follows a path to
> >> dist, and finds abc.exe, where it executes properly.
> >> Cute, eh? I have no explanation for it.
>
> > Are you sure it's executing abc.exe?  If you are at a Python command
> > prompt within the "DOS shell" and you just type just abc, I think what
> > is happening is you are running abc.py, NOT abc.exe.
>
> > py2exe creates a dist folder (short for "distributables") by default
> > and puts your .exe into it along with whatever other files are needed
> > to run your application.  Depending on how you set the bundling
> > options, this may be a lot of things or just 1-2 other things.
>
> > Che
>
> Well, you are right. What proof do I have? In fact, I just tried to run
> a program that was not converted, and left off py. It worked.
>
> So maybe the only way to execute the compiled code is to to to dist?

Not sure about that last question, but just try double-clicking on
the .exe file in dist and your app should run. In fact, copy that
dist folder to a flash drive, plug it into another computer that
doesn't have Python installed on it, and doubleclick it again--it'll
run again. In fact, depending on how you bundled it, you might need
only the .exe file on many computers that have the Windows dlls
already available.

Che

alex23

2/20/2010 5:27:00 AM

0

"W. eWatson" <wolftra...@invalid.com> wrote:
> So maybe the only way to execute the compiled code is to [g]o to dist?

Or the compiled code needs to be in a folder that's higher in your
path settings than the python file.

But yes, moving into the dist directory, or running 'dist/snowball'
from the project root will do the trick.

alex23

2/20/2010 5:39:00 AM

0

On Feb 20, 3:26 pm, alex23 <wuwe...@gmail.com> wrote:
> or running 'dist/snowball'

That should, of course, be: 'dist\snowball' :)