On 2/27/26 07:49, Em wrote:
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?
Microsoft keeps changing the underlying details for default apps ("file associations"). This is likely where you'll have to explore. It's not Python's fault, per se - I bet if you run your script from a terminal ("command line") it will work as expected. The Windows 11 setup you've been given must be different in some way to your old Win10 one.
You've left out too many details for people to dig deeper - how was the Python installed, for example - from the python.org installer, with/without the Python Launcher (now deprecated as of 3.14), Microsoft Store version, with the Python Manager?
This mailing list is quite inactive now. You may get more eyeballs by using the help channel on discuss.python.org, or maybe an external site like the Python Discord (should easily turn up in a web search - the links aren't human-memorable).
-- https://mail.python.org/mailman3//lists/python-list.python.org
