Minichan

Topic: ATTN: Anyone who knows python

Anonymous A started this discussion 15 years ago #11,091

How do I get the shell to open a script I made in notepad? My textbook says to save the script as whatever.py and then type "python whatever.py" into the shell. I did that and it didn't work. I experimented with variations of that and nothing else works, either. Nor can I find it on the internet.

All my script says is 'print "hello"' by the way. I just want to learn how to open the notepad file up & get it to run the script.

Anonymous B joined in and replied with this 15 years ago, 12 minutes later[^] [v] #198,544

Save the file as .py and in your command prompt/shell type "python filename.py"

You say that doesn't work? How about giving the output of the attempted command. Do you even have python installed?

Anonymous D joined in and replied with this 15 years ago, 4 minutes later, 16 minutes after the original post[^] [v] #198,547

do a barrel roll, or, if you are technologically inclined you could reverse the polarity

Anonymous E joined in and replied with this 15 years ago, 9 minutes later, 26 minutes after the original post[^] [v] #198,550

You probably need to add Python to your PATH. On Windows 7: Control panel -> System -> Advanced system settings -> Environment variables -> System variables -> Path -> Edit. Add Python's install directory to the end.

For future reference, never say "it didn't work". That doesn't mean anything.

Anonymous A (OP) replied with this 15 years ago, 8 minutes later, 34 minutes after the original post[^] [v] #198,552

Image went missing@198,544 (B)
Here's a picture. Syntax error. :/

@previous (E)
What do you mean by "Python's install directory"?

Anonymous B replied with this 15 years ago, 3 minutes later, 37 minutes after the original post[^] [v] #198,553

Derp. That's the Python Shell. Open the windows shell (cmd.exe) and try again. Report back if that works.

You can open a command prompt in a folder by shift clicking and then looking for "Open Command Prompt Here"

Anonymous A (OP) replied with this 15 years ago, 5 minutes later, 42 minutes after the original post[^] [v] #198,554

@previous (B)
Why would it not work in the python shell? I thought that's what one is supposed to use for testing stuff.

The windows shell didn't work, either. It says "'python' is not recognized as an internal or external command, operable program or batch file."

Anonymous B replied with this 15 years ago, 1 minute later, 44 minutes after the original post[^] [v] #198,555

@previous (A)
In the python shell you write python code. Either copy and paste your entire program in there (bad) or you can probably (Just thought of this) open a .py file with File->Open.

The best way is to do what @198,550 (E) said and close & reopen your command prompt and try again.

Anonymous E replied with this 15 years ago, 2 minutes later, 46 minutes after the original post[^] [v] #198,556

@198,552 (A)

> What do you mean by "Python's install directory"?

The folder with python.exe.

Anonymous F joined in and replied with this 15 years ago, 2 months later, 2 months after the original post[^] [v] #246,940

this is kinda funny

Anonymous G joined in and replied with this 15 years ago, 7 hours later, 2 months after the original post[^] [v] #247,047

install gentoo

!SEVFmYP0AU joined in and replied with this 15 years ago, 4 minutes later, 2 months after the original post[^] [v] #247,053

lol this was my thread

I am now a python master
:

Please familiarise yourself with the rules and markup syntax before posting.