• Persistent Error: Python was not found

    From Jonathan Owah@21:1/5 to All on Sat Aug 13 12:55:17 2022
    Good day,
    Great job on making Python easily accessible.

    I'm using a Windows 10, 64gb HP EliteBook.

    I've been trying to configure my laptop to run python scripts.
    This is the error I keep getting:
    Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution
    Aliases.

    Everything I've tried has failed.
    I've uninstalled and reinstalled
    I've added to path, both user and system path,manually and from fresh installation
    I've downloaded from Microsoft Store
    I've gone to manage app aliases and switched off
    I've used Git Bash, Powershell, cmd

    I'm able to check my python version: 3.10.6.

    I can't do anything else and it's really frustrating.

    I've been at it for days, I don't know what else to do.

    Thanks in advance for your help.

    Regards

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike Dewhirst@21:1/5 to All on Mon Aug 15 14:38:25 2022
    This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------HLWaGuNBTOkduabTrPQJNJ02
    Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64

    Sm9uYXRoYW4NCg0KVGhpcyBpcyB3aGF0IEkgd291bGQgZG8gLi4uDQoNCjEuwqDCoMKgIERv d25sb2FkIFB5dGhvbiBmcm9tIHB5dGhvbi5vcmcgbm90IE1pY3Jvc29mdA0KDQoyLsKgwqDC oCBJbnN0YWxsIGFzIGFuIGV4cGVydCBvciBjdXN0b20gaW5zdGFsbCB0byBDOlxQeXRob24z MTAgcmF0aGVyIHRoYW4gDQpDOlxQcm9ncmFtIGZpbGVzDQoNCjMuwqDCoMKgIElnbm9yZSB0 aGlzIHBvaW50IC0gSSB3YXMgZ29pbmcgdG8gbWVudGlvbiBWaXJ0dWFsRW52IHdoaWNoIGNv bWVzIA0KbGF0ZXIgZm9yIHNvZnR3YXJlIGRldmVsb3BtZW50IGFuZCB0aGVyZWFmdGVyIHlv dSBkb24ndCBuZWVkIHRvIHB1dCANClB5dGhvbiBvbiB0aGUgV2luZG93cyBwYXRoLi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gpGvW31BqCOLMFAmL5zcEFAwAAAAAACgkQGvW31BqCOLMF SQf/ZcmbLjPzGYvZTzpZKU/PmI+0Izpn9qTq4swy6HgIj/+X4vtVrACUs72BSenRgh6C3n7ulJ61 IX8fsVW1Jwl/gep7q0ltmA2++CDRV/OkIjb1xQgd0Pg9nAuFq9+SMycH88e+ydRxykpx+ILpg27D okUe+ZIiZsgdHBVzntKD2+HfFjecqSmfQaBPPxb02jO8xQF27cx7JMtvO1LX5Uurf2KPd2wxweqN FCj/ShmHrZsfPEdSfZYeb5zITb5BL9/5bFYWMnEez2HW3H4RuoJBZEPmRETieO6COcTV6jMAQX7Z toY8tIiZt5Jmy8c1WXTFQY7wtvcJba9KvxPBx+2z1Q==
    =Wr63
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Barry@21:1/5 to All on Mon Aug 15 07:51:53 2022
    On 15 Aug 2022, at 04:10, Jonathan Owah <owahjonathan@gmail.com> wrote:

    Good day,
    Great job on making Python easily accessible.

    Try using the python launcher py.exe.
    It is documented here https://docs.python.org/3/using/windows.html#python-launcher-for-windows
    That page documents lots of other things that you may need to know about on windows.

    Barry


    I'm using a Windows 10, 64gb HP EliteBook.

    I've been trying to configure my laptop to run python scripts.
    This is the error I keep getting:
    Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution
    Aliases.

    Everything I've tried has failed.
    I've uninstalled and reinstalled
    I've added to path, both user and system path,manually and from fresh installation
    I've downloaded from Microsoft Store
    I've gone to manage app aliases and switched off
    I've used Git Bash, Powershell, cmd

    I'm able to check my python version: 3.10.6.

    I can't do anything else and it's really frustrating.

    I've been at it for days, I don't know what else to do.

    Thanks in advance for your help.

    Regards
    --
    https://mail.python.org/mailman/listinfo/python-list


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eryk Sun@21:1/5 to Jonathan Owah on Mon Aug 15 02:14:30 2022
    On 8/13/22, Jonathan Owah <owahjonathan@gmail.com> wrote:

    I've been trying to configure my laptop to run python scripts.
    This is the error I keep getting:
    Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution
    Aliases.

    If you keep seeing this message, then the shell is finding and running Microsoft's default "python.exe" redirector app execution alias that's
    located in "%LocalAppData%\Microsoft\WindowsApps". By default, this
    directory is set at the beginning of the user "Path" value in the
    registry and thus takes precedence (but not over the system "Path").
    Confirm this by running `where.exe python`.

    An app execution alias is a special type of filesystem symbolic link
    to a store app's executable. These aliases are created in a user's "%LocalAppData%\Microsoft\WindowsApps" directory. Store apps
    themselves are usually installed in "%ProgramFiles%\WindowsApps",
    which is a system managed directory that even administrators can't
    easily modify (and shouldn't modify). Each user on a system has their
    own set of installed store apps, even though the apps are installed
    only once at the system level.

    By default, Windows creates "python.exe" and "python3.exe" aliases for
    the "App Installer" PythonRedirector app. In the alias manager, these
    two will be clearly listed as aliases for "App Installer". If you run
    this redirector app with one or more command-line arguments, it will
    print the above quoted message to the console. If the redirector app
    is run without arguments, it will open the Microsoft Store to install
    the latest version of the Python store app distribution. Currently
    that means Python 3.10.

    In my experience, the app execution alias manager component of Windows
    is unreliable. A disabled alias might still exist in "%LocalAppData%\Microsoft\WindowsApps", or an old alias might be left
    in place when an app is installed. Once the real Python store app is installed, go back into the alias manager and toggle the "python.exe"
    and "python3.exe" aliases off and back on. If that doesn't resolve the
    problem, manually delete the "python.exe" and "python3.exe" aliases
    from "%LocalAppData%\Microsoft\WindowsApps". Then toggle them off and
    on again in the alias manager. Hopefully they'll be created to
    correctly alias the real Python app instead of the "App Installer"
    redirector.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jonathan Owah@21:1/5 to eryksun@gmail.com on Mon Aug 15 10:11:08 2022
    Thank you so much for your assistance .

    The fault was actually mine: I was running a command
    with python3, instead of just python.
    python3 works for Mac, but not Windows.

    I'm fairly new to Python so I was just following along a
    tutorial, and I didn't take note of the fact that the command
    didn't work because the tutorial was done on a MacBook,
    while I'm using a Windows device.

    Thanks for your help,
    Regards

    On Mon, Aug 15, 2022 at 8:14 AM Eryk Sun <eryksun@gmail.com> wrote:

    On 8/13/22, Jonathan Owah <owahjonathan@gmail.com> wrote:

    I've been trying to configure my laptop to run python scripts.
    This is the error I keep getting:
    Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.

    If you keep seeing this message, then the shell is finding and running Microsoft's default "python.exe" redirector app execution alias that's located in "%LocalAppData%\Microsoft\WindowsApps". By default, this
    directory is set at the beginning of the user "Path" value in the
    registry and thus takes precedence (but not over the system "Path").
    Confirm this by running `where.exe python`.

    An app execution alias is a special type of filesystem symbolic link
    to a store app's executable. These aliases are created in a user's "%LocalAppData%\Microsoft\WindowsApps" directory. Store apps
    themselves are usually installed in "%ProgramFiles%\WindowsApps",
    which is a system managed directory that even administrators can't
    easily modify (and shouldn't modify). Each user on a system has their
    own set of installed store apps, even though the apps are installed
    only once at the system level.

    By default, Windows creates "python.exe" and "python3.exe" aliases for
    the "App Installer" PythonRedirector app. In the alias manager, these
    two will be clearly listed as aliases for "App Installer". If you run
    this redirector app with one or more command-line arguments, it will
    print the above quoted message to the console. If the redirector app
    is run without arguments, it will open the Microsoft Store to install
    the latest version of the Python store app distribution. Currently
    that means Python 3.10.

    In my experience, the app execution alias manager component of Windows
    is unreliable. A disabled alias might still exist in "%LocalAppData%\Microsoft\WindowsApps", or an old alias might be left
    in place when an app is installed. Once the real Python store app is installed, go back into the alias manager and toggle the "python.exe"
    and "python3.exe" aliases off and back on. If that doesn't resolve the problem, manually delete the "python.exe" and "python3.exe" aliases
    from "%LocalAppData%\Microsoft\WindowsApps". Then toggle them off and
    on again in the alias manager. Hopefully they'll be created to
    correctly alias the real Python app instead of the "App Installer" redirector.


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eryk Sun@21:1/5 to Jonathan Owah on Mon Aug 15 04:41:21 2022
    On 8/15/22, Jonathan Owah <owahjonathan@gmail.com> wrote:
    Thank you so much for your assistance .

    The fault was actually mine: I was running a command
    with python3, instead of just python.
    python3 works for Mac, but not Windows.

    If the Python 3.10 store app is installed with all aliases enabled,
    then "python", "python3", and "python3.10" all work. The standard
    distribution from python.org, on the other hand, only has a "python" executable.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dennis Lee Bieber@21:1/5 to All on Mon Aug 15 10:27:56 2022
    On Mon, 15 Aug 2022 14:38:25 +1000, Mike Dewhirst <miked@dewhirst.com.au> declaimed the following:

    If you want to execute a python script without first opening a cmd
    prompt, you need a bat file or shortcut which contains the command line
    you want executed. Give that a double-click and it should also work.


    I've never had to do that... But I have file associations set up so that .py is considered to be an executable file.

    Just double-clicking on the file will run it. The problem is that it will open a command shell, run, and then close the command shell UNLESS one explicitly codes some sort of "hold" at the end of the program

    jnk = input("Press return to exit")

    .pyw extension does not open the command shell -- but is meant for programs that use one of the various GUI frameworks, which is probably more than the new-comer is ready to attack.


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Gisle Vanem@21:1/5 to Eryk Sun on Mon Aug 15 13:58:42 2022
    Eryk Sun wrote:

    If the redirector app
    is run without arguments, it will open the Microsoft Store to install
    the latest version of the Python store app distribution. Currently
    that means Python 3.10.

    That is true with cmd. But with a shell like 4NT, I get:
    c:\> "%LocalAppData%\Microsoft\WindowsApps\python.exe"
    4NT: (Sys) No access to the file.
    "C:\Users\gvane\AppData\Local\Microsoft\WindowsApps\python.exe"

    No matter what I do with this "App Alias" setting.
    What a broken and confusing design this AppX design is.


    --
    --gv

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eryk Sun@21:1/5 to Dennis Lee Bieber on Mon Aug 15 11:46:50 2022
    On 8/15/22, Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote:

    Just double-clicking on the file will run it. The problem is that it will open a command shell, run, and then close the command shell UNLESS one explicitly codes some sort of "hold" at the end of the program

    The console window is a terminal, not a shell. If an application is
    flagged as a console app, as is "python.exe", and the process doesn't
    inherit a console, the initialization code in kernelbase.dll allocates
    a new console session. This could be implemented by the classic
    conhost.exe host, or, in Windows 11, by an openconsole.exe session
    that's associated with a tab in Windows Terminal. If it's the latter,
    Terminal can be configured to keep a tab open after the console
    session has ended. The tab will display the exit status of the process
    that allocated the console session.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eryk Sun@21:1/5 to Gisle Vanem via Python-list on Mon Aug 15 11:35:07 2022
    On 8/15/22, Gisle Vanem via Python-list <python-list@python.org> wrote:
    Eryk Sun wrote:

    If the redirector app
    is run without arguments, it will open the Microsoft Store to install
    the latest version of the Python store app distribution. Currently
    that means Python 3.10.

    That is true with cmd. But with a shell like 4NT, I get:
    c:\> "%LocalAppData%\Microsoft\WindowsApps\python.exe"
    4NT: (Sys) No access to the file.
    "C:\Users\gvane\AppData\Local\Microsoft\WindowsApps\python.exe"

    No matter what I do with this "App Alias" setting.
    What a broken and confusing design this AppX design is.

    An app execution alias is a reparse point with the tag IO_REPARSE_TAG_APPEXECLINK (0x8000001B). Neither the I/O manager no
    any driver in the kernel supports this type of reparse point. For
    better or worse, this is intentional. As such, if CreateFileW() is
    called on an alias without using the flag
    FILE_FLAG_OPEN_REPARSE_POINT, the attempt to traverse the link fails
    with ERROR_CANT_ACCESS_FILE (1920). Note that Python's os.stat() was
    updated to open the reparse point directly in this case instead of
    failing. But a lot of applications, in particular non-Microsoft shells
    such as MSYS bash (and apparently 4NT) haven't been updated similarly.

    Even if the link could be traversed, the target file under "%ProgramFiles%\WindowsApps" doesn't grant execute access to users
    unless they have an access token that includes a WIN://SYSAPPID
    attribute that corresponds to the executed app. How this works in
    practice when executing an app is that CreateProcessW() handles ERROR_CANT_ACCESS_FILE by opening the reparse point, reading the
    relevant app information, and creating a custom access token that
    allows it to execute the app directly via the internal equivalent of CreateProcessAsUserW().

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)