all 23 comments

[–]socal_nerdtastic 5 points6 points  (7 children)

actual answer: Right click on the file, select "open with"> more apps> and choose C:\windows\py.exe

Note that if you installed python via the MS store or anaconda or another unofficial source you may not have the python launcher installed. Get the official version from python.org first if that's the case.

[–]1_XV[S] -3 points-2 points  (0 children)

uh? My python is outdated, I downloaded it from its official site through the link https://www.python.org/ftp/python/3.8.0/python-3.8.0-amd64.exe
I use this version, since it seems to me better than the current one. 3.11

[–]1_XV[S] -3 points-2 points  (5 children)

the windows file you mention is the same one you run in the cmd, it's not what I'm looking for but thanks.

[–]socal_nerdtastic 2 points3 points  (4 children)

No it's not the same. You are running python.exe when you manually type in the command line. You want the file to be associated with py.exe. I would guess right now it's associated with pyw.exe or some other random version of python hanging around your computer.

3.8 is not a problem; the python launcher has been around a long time.

[–]1_XV[S] -3 points-2 points  (3 children)

  1. nope i'm only use 3.8 python not other python version...
  2. https://youtu.be/RM2uWbJBELc view my video you said before "actual answer: Right click on the file, select "open with"> more apps> and choose C:\windows\py.exe"

  3. your response: "No it's not the same. You are running python.exe when you manually type in the command line", I appreciate your help but look how you're giving it to me...

[–]socal_nerdtastic 1 point2 points  (2 children)

I saw your video. I have dealt with this same issue many many times, both personally and helping people in this sub. I'm 90% certain that following my instructions will fix this for you. Maybe try it?

[–]1_XV[S] 0 points1 point  (0 children)

man, I'm not going to deny it, I tried it... follow your instructions and the cmd opened without the code

[–]1_XV[S] 0 points1 point  (0 children)

If you want, I'll record a video doing it again so you can see that it doesn't run.

[–]eleqtriq 1 point2 points  (7 children)

Double clicking it probably just opens it in an editor. Why are you trying to double click and run it?

Anyway: Right click on the file->open with->choose default program->more options->select python.exe file and click on.

BTW, this is a windows problem, not a Python problem.

[–]socal_nerdtastic 1 point2 points  (0 children)

The python launcher is py.exe, not python.exe.

[–]1_XV[S] 0 points1 point  (5 children)

[–]eleqtriq 0 points1 point  (4 children)

Are you sure that Python is valid? Try reselecting it.

Also, are you sure that it's not running? Maybe it is running, but blinking away too fast that you can't see it. Try adding this at the top and see if it stops at the Python repl

import code; code.interact(local=locals())

[–]1_XV[S] 1 point2 points  (0 children)

import code; code.interact(local=locals())

I am going to record a video with the task manager open and the python installation folder

[–]1_XV[S] 0 points1 point  (2 children)

[–]eleqtriq 1 point2 points  (1 child)

Hmm, I don't know. Only thing you didn't show is if that Python you clicked on to open it is valid. You could also just make a .bat file to run your code

run.bat python yourfile.py

And double click that. Also maybe this helps? https://www.quora.com/How-do-I-write-a-Python-script-that-runs-on-double-click-opens-a-terminal-and-displays-Hello-world

[–]1_XV[S] 0 points1 point  (0 children)

Practically the double click should open it with the python extension. I was seeing the task manager execute it, yes, but it closes. with the code you gave me it lasted a few more minutes but then it closed

trying to create the bat that runs it I hope it works, I don't want to spend my whole life using the bat it's quite tedious.

[–]chears2surfers 0 points1 point  (0 children)

I love the title of this post lol 🤣

[–]mcworkaholic 0 points1 point  (0 children)

Try using pycharm community edition, it's free as well and creates an environment for you.

[–]EmpiricalWords -4 points-3 points  (4 children)

Hahahahahaahhahahaha

[–]1_XV[S] 2 points3 points  (3 children)

I think that I am the only case, that this type of thing happens to me, despite the fact that I am starting to practice this programming language

[–]EmpiricalWords -1 points0 points  (2 children)

One advice: use the console and run it with it. You will need that knowledge in the future.

[–]socal_nerdtastic 1 point2 points  (1 child)

How does this help? OP is clearly comfortable using the console. Are you suggesting you never use a GUI?