Jump to content

Recommended Posts

Posted

Read the instructions? Specifically, the bit that looks like this:

 

Let’s suppose you have a program called pytest.py in directory C:\Steve\Projects\Python. A session to run that program might look like this:
Posted (edited)

Read the instructions? Specifically, the bit that looks like this:

i don't understand much of what it says...so where does it say what I'm supposed to DO

is it trying to say that i need a more complete file path

or what?

nowhere do I see a "click on this it will open the area where you type you're code"

or a "remember to include this in your command"

is there a cliff notes version of this?

any difference between typing python.exe vs python?

Edited by dragonstar57
Posted

You're going to have to learn to read documentation if you want to be able to program.

 

Short version: Figure out where you saved your program. Perhaps you saved it in C:\Users\dragonstar\program.py. Open up Command Prompt. Type

cd C:\Users\dragonstar

then

dir

 

You'll see a list of all files in that directory. Make sure your program is one of them. Now type

 

python program.py

and your program will run.

Posted

Perhaps you should try some of the Youtube tutorials on Python under Windows. They might show you where to click when.

Posted

You're going to have to learn to read documentation if you want to be able to program.

 

Short version: Figure out where you saved your program. Perhaps you saved it in C:\Users\dragonstar\program.py. Open up Command Prompt. Type

cd C:\Users\dragonstar

then

dir

 

You'll see a list of all files in that directory. Make sure your program is one of them. Now type

 

python program.py

and your program will run.

C:\Python22

file "<stdin>", line 1

C:\Python22

^

Posted

Open Command Prompt. Not "Python (Command Line)". Command Prompt. Stop opening the Python interpreter directly, because that expects you to type in Python code directly.

yeah that was command prompt-python (what i got after i typed python into the command prompt window)

was i not supposed to type python into command prompt"?

Posted (edited)

No, you were not. You were supposed to follow the instructions exactly as I typed them.

note: myfirstprogram.py is saved on the desktop and on the C:(there are two copies) drive under the folder Python22

C:\python22 dir

C:\Documents and settings/owner>cd C:\python22 dir

the system cannot find the path specified.

C:\documents and settings \owner>

Edited by dragonstar57
Posted

You're supposed to press Enter before dir; it goes on a separate line, because it is a separate command.

 

First use "cd" to get to the folder, then use "dir" to list its contents, after you have entered the folder.

Posted (edited)

You're supposed to press Enter before dir; it goes on a separate line, because it is a separate command.

 

First use "cd" to get to the folder, then use "dir" to list its contents, after you have entered the folder.

done its there now what?

exec myfirstprogram.py?

Edited by dragonstar57
Posted

So it says:

C:\python22> 

 

in the command prompt now?

 

If so, type "dir" and hit enter. You'll see a list of files. Now type, without the quotes, "python nameOfYourFile.py", being sure to replace that with the name of your file. It should run.

Posted (edited)

So it says:

C:\python22> 

 

in the command prompt now?

 

If so, type "dir" and hit enter. You'll see a list of files. Now type, without the quotes, "python nameOfYourFile.py", being sure to replace that with the name of your file. It should run.

ok it worked

thankyou

if i were dealing with another folder would the file path just be longer

ie if there was another folder in Python22

would it just be something like

C:\Python22:/programs

Edited by dragonstar57

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.