How Do I Add Environment Variables to launch.json in VSCode?

VS Code lets you pass environment variables to a debug session from .vscode/launch.json. This is useful when a Python app needs settings like an API base URL, feature flag, database name, or development mode value while you are debugging locally. The simplest option is the env object inside a debug configuration. Each key becomes an … Read more

VSCode: How to Set Working Directory for Debugging a Python Program

When a Python program behaves differently in VS Code than it does in your terminal, the working directory is often the reason. Relative paths such as data/input.csv, settings.json, or ./logs/app.log are resolved from the current working directory, not necessarily from the file you are debugging. In VS Code, the Python debugger reads its launch settings … Read more

Generating Matplotlib Graphs Without a Running X Server

Matplotlib is often used on laptops and desktop machines where a graphical display is available. On a server, cron job, Docker container, CI worker, or SSH-only environment, that assumption can break. If Matplotlib tries to use an interactive backend that expects an X server, your script may fail with display-related errors instead of producing a … Read more