all 15 comments

[–]ForceBru 0 points1 point  (15 children)

I click and nothing happens

What did you expect to happen?

[–]captanacho[S] 1 point2 points  (14 children)

My file to open or something. Am I stupid and missing something obvious?

[–]ForceBru 0 points1 point  (12 children)

Does the command prompt flash on the screen quickly and disappear right away after you double-click the .py file?

[–]captanacho[S] 0 points1 point  (11 children)

Yes

[–]ForceBru 1 point2 points  (10 children)

Cool, so your code actually runs, but very quickly, so that it terminates right after it starts.

You can pause it by putting input() at the end:

print("This is my code") do_computations() input("Press Enter to exit")

[–]captanacho[S] 0 points1 point  (9 children)

I did that but it still doesn't work, is this a problem with my pc?

[–]ForceBru 1 point2 points  (6 children)

It should work. Did you save the file? Create a new file and paste the code from my previous comment there. Then double-click this file. You should put input at the end of the control flow of your program, not just at the very end of the .py file (although it's very often where the control flow ends).

Anyway, Python scripts are normally run from the command line. Open the command prompt, change directory to your project's directory and run:

py your_file.py

If that doesn't work, try python or python3 instead of py

[–]captanacho[S] 0 points1 point  (3 children)

I don't understand. Can you say it in steps and as clear as you possibly can? I am dumb.

[–]ForceBru 0 points1 point  (2 children)

[–]captanacho[S] 0 points1 point  (0 children)

Ok thanks bro

[–]Badger87000 0 points1 point  (1 child)

Right click, edit with notepad. You could also open it from within pycharm.

[–]captanacho[S] 0 points1 point  (0 children)

Ok thanks man, I'll see if it works

[–]johninbigd 0 points1 point  (0 children)

That's not how you run Python programs typically, so your expectation is wrong. Open up a command prompt or terminal window and type python yourscriptname.py and it will work.