50.7 Environment Variables and Working Directory
When an external command is executed via the subprocess module, it inherits a runtime context from the Python process that spawned it. This context includes two critical components: the set of environment variables and the current working directory. Understanding how to control and modify this context is essential for ensuring that the child process behaves as expected, as many programs rely on these settings for configuration and file path resolution.