This is my first time programming anything and i'm reading the learning python book. I'm stuck at step one and very annoyed. I'm trying to run just a simple print saved program i wrote in notebook. For some reason i can't open it, ive gotten to the point where i have >>> waiting for my command but i try typing C:\python25\python script.py and script.py and even just python script.py and a bunch of other combinations. I'm on a windows vista. What do i type exactly to open up a script. It's saying it's not defined
thanks Jessie

If you've written the script with IDLE, the best (and easiest) way to run it is by pressing F5 inside IDLE (once you've got the file open).

If you've written it with some other editor, then you need to go into Window's vista command prompt, navigate to the folder where you saved the script (cd command), and then type script.py .

Note, if you have >>> that means you are in the python interpreter and not command prompt.

If you've written the script with IDLE, the best (and easiest) way to run it is by pressing F5 inside IDLE (once you've got the file open).

If you've written it with some other editor, then you need to go into Window's vista command prompt, navigate to the folder where you saved the script (cd command), and then type script.py .

Note, if you have >>> that means you are in the python interpreter and not command prompt.

Thanks for the reply. I wrote it with notebook. I've navigated to where the file is and it says its not defined... i don't understand what im doing wrong. let me get this straight once im in python interpreter then i can just write the script.py?

Not exactly.

The easiest way is to start IDLE (Python GUI). On the file menu, click open to load your script, and then press F5 to run it.

If you want to write new scripts with it, start the python gui. On the file menu choose New Window and type your code there. Save it and then press F5 to run it.

o ok so you don't always have to use command prompt it's a preference? you can use the IDLE just fine? Wow thank you for clearing that up, ha i was so frustrated i'm still learning the basics. It's hard to learn for my first time just from a book, thanks for answering my question.

IDLE is perfect for newbies. The only thing to bear in mind; when you start learning GUIs you shouldn't run them in IDLE as they make it unstable, but for now IDLE is good.

One more question if that's okay. So you don't always use the command prompt? so if i was more experienced and i was trying to call up a script i wrote would i use the command prompt or not? I mean using the IDLE is that just another way to call up scripts? or is it just a place to write scripts? thanks

Alternatively you can add python to your environment variables so that you just navigate to the file in command prompt and type command: python yourscript.py and there you go!

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.