I'll try to start over again:
Windows7, Python3.2..
When I click on a *.py file
it starts up the python.exe interpreter in interactive mode.
What I want it to do, is to RUN the *.py file.
Please, how can I accomplish this.
A *.py file is associated with python.exe .
Thanks for your help...Vernon

Recommended Answers

All 11 Replies

you should have python IDLE GUI if you downloaded the pakcage from python official site.
http://www.python.org/download/
select Python 3.2.3 Windows X86-64 MSI Installer .

you will have IDLE after intalling .

open IDLE . then go to File>open and select your .py file. a window will appear with the source code pf the file.
on the menu bar,select RUN. (or F5) .that is it!

If you need your py file as an exe, you need to install a separate software like py2exe and compile py to exe format.so you can run it like a normal .exe file using cmd. this will take time. there are more other programs than py2exe. can't remember them right now. many are free if you google

What if i wanted to send myProg.py to a friend (who has python installed) to RUN.
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.
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 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

Normally in windows, if you click on a .py file, it runs the file in a cmd console. If you want to run the program without console, you can rename it with the .pyw extension.

you can run the it from command line interface.
But IDLE is much more better!

Go to CMD(command window) and go the intallation directory of python by typing like this

cd "Program Files (x86)\Python2.7"

this will take you to that folder and cmd will look like this.
select your intallation folder and name instead of mine pat after 'cd'

 C:\Program Files (x86)\Python2.7>

.
then again type as below

python.exe C:\Python26\iu.py

replace 'your .py file's path with above path(C:\Python26\iu.py)

and it should look like this after

C:\Program Files (x86)\Python2.7>python.exe C:\Python26\iu.py
"this is how the text of  iu.py look like"

Done.

If you want to click and open any .py using interpreter
right click on any .py file.
select open with>choose default program ,from the menu.
and give the path of python.exe by browsing to the location
(Program Files (x86)\Python2.7 << this ,in my case)

I told you to google for that if you want to know more about them!
your friend will have to do the same as you (as mentioned above)

Before we all get royally confused, it looks like vmars installed portable python in a directory that is usually used for the nonportable Python version.

Gribouillis:
If i double click on turtleDemo.y
What i get back is a blank python interpreter,
but no turtleDemo.py or results.

I try to run python.exe from a .bat as follows:
cd C:\Python32
python.exe -m C:\Python32\App\Lib\turtledemo\turtleDemo.py
What i get back is a blank python interpreter,
but no turtleDemo.py or results.

I try to run pythonw.exe from a .bat as follows:
cd C:\Python32\App
pythonw.exe -m C:\Python32\App\Lib\turtledemo\turtleDemo.pyw
What i get back is a blank python interpreter,
but no turtleDemo.pyw or results.

Next i will answer silvercats Post.
Thanks...vm

silvercats:
...you can run the it from command line interface.
Assuming you mean the 'python.exe command line interface':
Pls, what would i enter at command line interface?
I tried the following, but i just get 'stdin syntax error':
-m C:\Python32\App\Lib\turtledemo\turtleDemo.py
and
runpy -m C:\Python32\App\Lib\turtledemo\turtleDemo.pyw

...C:\Program Files (x86)\Python2.7>python.exe C:\Python26\iu.py
When i enter:
python.exe C:\Python32\App\Lib\turtledemo\turtleDemo.py
What i get back is:
a empty interpreter >>>
no sign of turtleDemo.py

...f you want to click and open any .py using interpreter right click on any .py file.
What i get back is:
a empty interpreter >>>
no sign of turtleDemo.py

Thanks...vm

no no no...no.... It is not th Python command line interface(that is the interpreter).
you must do it in the windows command line. try this. press "windows+R " (it will bring out the RUN windows of windows). then type "cmd" . It will bring the comamnd line of windows.

Then do as I said.

.f you want to click and open any .py using interpreter right click on any .py file.
What i get back is:
a empty interpreter >>>
no sign of turtleDemo.p

Tell me what you did STEP BY STEP. slowly. in above case .There must have been a mistake.
if you can ,uploa screen captures of each steps.That is better. If not,describe each step .
becasue if you right click and went to 'open with' and selected write python.exe, it should work.

ALSO COPY PASTE THE SOURCE OF yOUR PYTHON SOource code too.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.