Question on running exe file in Python

joy99 subhakolkata1234 at gmail.com
Sun Feb 13 15:16:40 CET 2011


Thanks for your reply.
On Feb 13, 6:58 pm, Chris Rebert <c... at rebertia.com> wrote:
> On Sun, Feb 13, 2011 at 4:56 AM, joy99 <subhakolkata1... at gmail.com> wrote:
> > Dear Room,
>
> Just a friendly FYI: that's a strange salutation; comp.lang.python AKA
> python-list isn't a chat room, at least in the normal sense of the
> term.
I know that. It is a highly technical room. I have been visiting this
room for last 4 yrs or so, greeted people in the same way, but someone
felt hurt I saw for the first time!
>
> > I am using Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.
> > 1500 32 bit (Intel)] on win32 on Windows XP (SP2).
>
> > Trying to create an .exe file of my scripting file I had saved it
> > as .exe instead of .py file. It seems created. But how to run it? I
> > tried command prompt, seems unresponsive.
>
> You can't compile things to executables (i.e. machine code, i.e. .exe
> files) just by changing the file extension; you have to use a compiler
> to generate the .exe. Additionally, Python is normally an interpreted
> language; hence, it does not normally produce independent executables
> (unless possibly you're using a non-CPython implementation of Python).
> You can however generate self-contained executables for Python
> programs using special tools such as py2exe, cx_freeze, etc., which
> judging by your other post, you're already aware of. So, if you want
> to generate a .exe, you'll need to get one of those tools working.
>
> (Renaming a text .py file to a .exe results in your CPU trying to
> treat the text like it's binary machine code; since it's not machine
> code, the CPU ends up executing gibberish instructions, resulting in
> an error, freeze, or similar that causes the unresponsiveness you're
> observing.)
>
> Cheers,
> Chris
> --http://blog.rebertia.com
All you have to get a solution. That's the goal. Not how approach
should be.
You may be more learned, but doing an .exe file works. I googled out
and found the answer.
But somehow, I am finding the people visiting this forum have either
downsized, or their quality degraded.
I often find a web search gives better answers.
You can save as .pyw for .dll files. For .exe files, saving as .exe
simply works, you can get the result by
importing os, or by simply executing it from command prompt.

Best Regards,
Subhabrata.



More information about the Python-list mailing list