How to execute/run a *.py file, win7, py3.2..?

Dave Angel d at davea.name
Mon Apr 16 01:03:52 EDT 2012


On 04/16/2012 12:30 AM, vmars316 wrote:
> Greetings,
> windows7, portablePython3.2:
> What if i wanted to send myProg.py to a friend to RUN (who has python
> installed).
> Isn't there a way just to doubleClick on myProg.py, to get it into the
> interpret/RUN?
> Could i RUN a myProg.o ?
> There must be a way to initiate the RUNning of a myProg.py without
> IDLE or pyScript, or the like.
> What if i wanted to write my own program in maybe "C",
> who's job it is to initiate interpret/run any *.py program.
> How does IDLE or pyScript do it?
> And yes. i am interested in py2exe or the like, for windows7.
> And would like to know what's available, like py2exe.
>
> Thanks...vm

There's lots you don't say.  So I'll make some wild assumptions.

Your friend has Python 3.2 installed.  (not portable python)  She's
running Windows 7.  If she took the defaults, she should have the .py
extension associated with c:\somewhere\python27\python.exe

So yes, she can double-click on myProg.py in an explorer window. 
However, if there's any console output you want her to see, or if you
might have an error or two, it'd be convenient to do one of two things;

1) end the program with an input("Press Enter key to exit the script")
2) run it from a cmd prompt (Dos box).

She certainly doesn't need IDLE or pyScript;  I never use either of
them.  I do use Komodo IDE, but that's for debugging, not for running
the script.

myProg.o  is a Unix/Linux convention for an object file;  compiled but
not linked.  On Windows, that would be .obj.  And CPython does not
compile the code into a .obj,  It does compile modules into .pyc, but
that's no help for your question.

You can certainly write a C program, if you've bought a C compiler.  But
this is a Python forum.

Sorry, I have no experience with py2exe or the like.


-- 

DaveA




More information about the Python-list mailing list