Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Question on running exe file in Python

Reply
Thread Tools

Question on running exe file in Python

 
 
joy99
Guest
Posts: n/a
 
      02-13-2011
Dear Room,

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.

Best Regards,
Subhabrata.
 
Reply With Quote
 
 
 
 
Chris Rebert
Guest
Posts: n/a
 
      02-13-2011
On Sun, Feb 13, 2011 at 4:56 AM, joy99 <(E-Mail Removed)> 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 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
 
Reply With Quote
 
 
 
 
joy99
Guest
Posts: n/a
 
      02-13-2011
Thanks for your reply.
On Feb 13, 6:58*pm, Chris Rebert <(E-Mail Removed)> wrote:
> On Sun, Feb 13, 2011 at 4:56 AM, joy99 <(E-Mail Removed)> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding if Python Is Running In Console (python.exe) or Window (pythonw.exe) Chaos Python 1 08-15-2006 12:58 AM
Running a DOS exe file from python lblr33@yahoo.com Python 3 01-27-2006 05:45 PM
Re: python.exe vs pythonw.exe difference? Thomas Heller Python 0 03-02-2004 06:06 PM
RE: python.exe vs pythonw.exe difference? Tim Peters Python 0 03-02-2004 03:50 PM
python.exe vs pythonw.exe difference? Emile van Sebille Python 0 03-01-2004 11:34 PM



Advertisments