Trouble invoking Python on Windows

Continuing the discussion from Need help with python SQL:

Artem Yurov: I’ve diverted this to a new topic as it is unrelated to Humaira’s problem.

First, please post your code between triple backticks (“code fences”) - this preserves indentation and other punctuation. There’s a </> button on the toolbar to start such a section.

Regarding your invocation python3 read.py, what happens if you use the usual Windows invocation py read.py ?

Superficially, your debugging of the issue seams reasonable, but i am not a Windows person.

Have you looked at the Python on Windows FAQ?

Cheers,
Cameron Simpson

… also the FAQ above suggests that you may be able to just type read.py to run the script, because the .py extension should be associated with the Python executable.

Cheers,
Cameron Simpson

By default Windows 10 and 11 include “python.exe” and “python3.exe” aliases to an app that opens the store to let the user install the PSF’s Python app. If it’s passed command-line arguments, such as a filename, the store launcher fails with an error message that includes instructions for disabling the aliases.

Once the “python3.exe” alias is disabled, generally there is no “python3” command. The standard distribution from python.org has a “python.exe” binary, but not “python3.exe”. The OP got stuck here for some reason, even though they already ran python --version, which reported version 3.11.0.

Anyway, using the “py.exe” launcher should work. It’s installed by default, in which case it should be available in PATH.