Hi. I need help.
I have installed Python 3.2.2 and have been using IDLE (the "Python shell") to type and save a Python program, such as 'Hello World'.
However, the command prompt (the black box) will not allow me to type a Python program or to "run" a Python program. So I tried to run a Python program using Notepad++, and while I am able to type it, I am not able to save it.
I am not able to "run" any Python programs. I have read so much about Python, and have researched the situation in detail, and have experimented with various "environmental variables" and user/system paths. I need help to correct the situation..
Can someone please help me? Thanks for helping. I look forward to hearing from you.
Message Phone: 011- 1- 513-252-2936
www.HowToBeGifted.com - marketing communication, web design, and much more
run cmd to get to the shell.
in the shell, navigate to the directory where you have saved your file.
Tell us what happens.
Dear Joel: HI! Thanks for helping. When I use the Python shell, and navigate to the saved Python program, what happens is:
A second Python shell pops up, displaying the coding of the program (which is a tiny 'hello world' program). This is what is displayed in the second Python shell:
In the first Python shell, when I type in what you requested, this is what happens:
SyntaxError: invalid syntax
SyntaxError: invalid syntax
I am not able to use the Python shell to find the saved Python program. I am able to use Notepad++ to locate the saved Python program, but I cannot run the program. I cannot do anything with the command prompt (black box).
I request help to figure out how to run Python programs. Thanks for helping me!
from the >>>> stuff at the start of each line, you are in a python
shell. Don't do that. Just get into a command shell.
Since I believe you are in windows, press the start button, then run
command and the command you run should be cmd
This will bring you to a window which looks a lot like DOS used to
look. You probably are too young for that. Anyway, at that point,
try typing python myprogram.py
Dear Joel: Hi! Thanks for helping. I typed cmd, and got the same black box, this time labeled C:\windows\system32\cmd.exe instead of "Command Prompt". When I type python myprogram.py, this is what appears on the screen:'python' is not recognized as an internal or external command, operable program, or batch file.
Can you help me? I hope so!
Don't top post. Put your comments at the bottom of the message or
intersperse where appropriate. I'm not a windows guy anymore.
Someone who is can help you figure out how to find out where python is
and put it on your path.
In the mean time, google "microsoft python setting up path" and you
may be on your way!
Thanks! I hope to find a Windows7 expert to help me.
You don't need a Windows 7 expert, just to set things
First open up Notepad++ again and enter everything between
the #### then save to a file called myHello.py and exit Notepad++.
print ("Hello world, Python calling!")
input("Hit return to exit")
Find myhello.py in Windows explorer and double click it.
(It's probably a good idea to create a special folder to
store your python programs. It'll be easier to find them
in the future!)
If python is installed correctly a black window should
Hello world, Python calling
Hit return to exit
If you hit return the window should close.
Now open the same file in IDLE (File->Open)
You should have a new edit window.
In IDLE choose the Run->Run Module menu item.
Your program should now run inside IDLE and display its output in the
Python Shell window of IDLE. When you hit return this time IDLE stays
open but returnms to the Python shell prompt >>>
If that all works, great, you are set up. If it doesn't come back and
tell us *exactly* what you did and what was displayed. Copy 'n paste any
error messages if possible.
Author of the Learn to Program web site http://www.alan-g.me.uk/