Environment Variables in Python on Linux

前端 未结 5 1130
别那么骄傲
别那么骄傲 2020-12-05 11:53

Python\'s access to environment variables does not accurately reflect the operating system\'s view of the processes environment.

os.getenv and os.environ do not func

5条回答
  •  抹茶落季
    2020-12-05 12:09

    I don't believe many programs EVER expect to have their environment externally modified, so loading a copy of the passed environment at startup is equivalent. You have simply stumbled on an implementation choice.

    If you are seeing all the set-at-startup values and putenv/setenv from within your program works, I don't think there's anything to be concerned about. There are far cleaner ways to pass updated information to running executables.

提交回复
热议问题