Another issue between Win10 and Win 11 using python

"Em" <[email protected]> Fri, 27 Feb 2026 09:49:11 -0500
Newsgroups gmane.comp.python.general
Message-ID <[email protected]>
The statement is: ThisPath = os.getcwd()

For 10 years in Win 10 the line gave me the present path both when I used F5 in an editor, and when I ran the program by a double-click on the name of the program in the folder.

I now want to run the program in Win 11.
As in Win 10, F5 from an editor, it gives me the present path but when I double-click on the program in the folder, it gives me some system path on the C drive.

This is now the second line of code that fails like this.
Can someone explain why.
Can you suggest a line of code to get the present path for this that is allowed by Win 11?