79578638

Date: 2025-04-17 06:48:29
Score: 1.5
Natty:
Report link

Self‑Answer: Root Cause and Fix

Apologies for the confusion and for taking up your time with this—it was my own mistake. I really appreciate your help.

After all the investigation above, I finally discovered the true culprit: a project‑root .env file that I had added for other tooling (e.g. to set JAVA_HOME for a Processing‑like Python library py5). That file contained something like:

# .env at the workspace root
JAVA_HOME=C:\Some\Java\Path
PATH=$JAVA_HOME$;$PATH

Why this caused the issue

The fix

Remove or adjust the .env so it doesn’t clobber your entire PATH. For example, change it to extend rather than replace(change $VAR to %VAR%):

# .env — extend the existing PATH instead of overwriting it
JAVA_HOME=C:\Some\Java\Path
PATH=%JAVA_HOME%;%PATH%

After making one of these changes, PowerShell subprocesses under debugpy will once again inherit the full environment, and $env:PROGRAMFILES, $env:LOCALAPPDATA, etc. will be populated as expected.

Reasons:
  • Blacklisted phrase (2): appreciate your help
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: KLc3088