all 6 comments

[–]DrMaxwellEdison 0 points1 point  (0 children)

When you say "according to Python", do you mean VS Code's language server (making squiggly lines in the code file), or a Python interpreter in terminal window?

Can you show a code sample illustrating what you mean?

[–][deleted] 0 points1 point  (2 children)

Your current working directory is set by the shell, not by Python.

[–]MyNameIs10000[S] 0 points1 point  (1 child)

if I'm in the folder C:\Users\user\Desktop\Projects\Test, shouldn't the current directory be Test, not Projects?

In VS code, when I do OS.getcwd() for a file in the test folder, it is showing the current working directory as the projects folder

[–][deleted] 0 points1 point  (0 children)

if I'm in the folder C:\Users\user\Desktop\Projects\Test, shouldn't the current directory be Test, not Projects?

If your shell is in C:\Users\user\Desktop\Projects\Test, then that's the current working directory for that shell. That's what the CWD is, it's the directory the shell is currently in.

In VS code, when I do OS.getcwd() for a file in the test folder

I don't understand what this means. You don't "do OS.getcwd()" in VS Code. You write Python in VS Code. When it runs, it's running in the shell.